Patiala state was established in 1763 by Ala Singh, who laid the foundation of the Patiala fort known as Qila Mubarak, around 'which the present city of Patiala is built. After the Third Battle of Panipat in 1761 in which the Marathas were defeated by the Afghans, the writ of the Afghans prevailed throughout Punjab. It is at this stage that the rulers of Patiala began to acquire ensigns of royalty. The Patiala state saw more than forty years of a ceaseless power struggle with the Afghan Durrani Empire, Maratha Empire and the Sikh Empire of Lahore.
In 1808, the Raja of Patiala entered into a treaty with the British against Sikh ruler Maharaja Ranjit Singh of Lahore in 1808, thus becoming collaborator in the grand empire building process by the British in, the sub-continent of India. Patiala became a 17-guns salute state during the British Raj. The rulers of Patiala such as Karam Singh, Narinder Singh, Mahendra Singh, Rajinder Singh, Bhupinder Singh, and Yadvindra Singh were treated with respect and dignity by the British.