It also gave its name to a former princely state of British India, once ruled by a Muslim Nawab from the Afghan Rohilla tribe. It was incorporated into the state of Uttar Pradesh in 1949. The region around Rampur and Bareilly still has a substantial population of Pashtuns.
In the medieval period Rampur was usually controlled by the current ruler of Delhi, and was divided between Badayun and Sambhal districts. Being situated in the Northern part of Rohilkhand, it was known by the name of Kather and was ruled by Katheria Rajputs. The Katheria Rajputs fought for about 400 years with the rulers of Delhi and later with the Mughals. They fought against Nasiruddin Mahmud in 1253, Ghiyasuddin Balban in 1256, Jalaluddin Firoz in 1290, Firoz Shah in 1379 and Sikander Lodhi in 1494. In 1623 two Afghan brothers of the Rohilla tribe, Shah Alam and Husain Khan, settled here and founded a small state, bringing with them many other Pashtun settlers. Ali Muhammad Khan, grandson of Shah Alam, united the Rohillas between 1707 and 1720, making Bareilly his capital. His uncle, Hafiz Rahmat Khan, who succeeded him, extended his power from Almora in the North to Etawah in the South-West. The Rohilla War of 1774-5 began when the Rohillas reneged on a debt they owed the Nawab of Oudh for military assistance against the Marathas in 1772. The Rohillas were defeated and driven from their former capital of Bareilly by the Nawab of Oudh with the assistance of the East India Company's troops. The Rohilla State of Rampur was established by Nawab Faizullah Khan on October 7, 1774 in the presence of British Commander Colonel Champion, and remained a pliant state under British protection thereafter.
The first stone of the new Fort at Rampur was laid in 1775 by Nawab Faizullah Khan. Originally it was a group of four villages named Kather, the name of Raja Ram Singh. The first Nawab proposed to rename the city 'Faizabad'. But many other places were known by the name Faizabad so its name was changed to Mustafabad Alias RAMPUR. Nawwab Faizullah Khan ruled for 20 years. He was a great patron of scholarship, and began the collection of Arabic, Persian, Turki and Urdu manuscripts which now make up the holdings of the Rampur Raza Library. After his death his son Muhammad Ali Khan took over, but he was killed by the Rohilla leaders after 24 days, and Ghulam Muhammad Khan, the brother of the deceased, was proclaimed Nawab. The East India Company took exception to this, and after a reign of just 3 months and 22 days Ghulam Muhammad Khan was defeated by its forces, and the Governor-General made Ahmad Ali Khan, son of the late Muhammad Ali Khan, the new Nawab. He ruled for 44 years. He did not have any sons, so Muhammad Sa'id Khan, son of Ghulam Muhammad Khan, took over as the new Nawab. He raised a regular Army, established Courts and carried out many works to improve the economic conditions of farmers. His son Muhammad Yusuf Ali Khan took over after his death. His son Kalb Ali Khan became the new Nawab after his death in 1865.
Nawab Kalb Ali Khan was literate in Arabic and Persian. Under his rule the state did much work to uplift standards of education. He was also a Member of Council during the Viceroyalty of Lord John Lawrence. He built the Jama Masjid in Rampur at a cost of Rs. 3 Lakhs. He was also knighted in Agra by the Prince of Wales. He ruled for 22 years and 7 months. After his death his son Mushtaq Ali Khan took over. He appointed W. C. Wright as the Chief Engineer of the estate. He built many new buildings and canals. Nawab Hamid Ali became the new ruler in 1889 at the age of 14. Many new schools were opened during his reign, and lots of donations were provided to nearby colleges. He donated Rs. 50,000 to Lucknow Medical College. In 1905 he built the magnificent Darbar Hall within the Fort which now houses the great collection of Oriental manuscripts held by the Rampur Raza Library. His son Raza Ali Khan became the last ruling Nawab in 1930. On July 1, 1949 the State of Rampur was merged into the Republic of India. Rampur today presents a slightly decayed appearance: the palaces of the Nawabs are crumbling, as are the gates and walls of the fort. However, the Library remains a flourishing institution of immense value to scholars from all over the world.
More recently Murtaza Ali Khan and Mikki Mia, who continued to use the title of Nawab as a token, but who never ruled Rampur, are now dead. It is an interesting historical fact that Murtaza Ali contested an election from Rampur opposite his own mother Rafat Jamani Begum in 1972 and won. Although the two brothers were always political rivals they never faced each other in elections. Subsequently, the family was also involved in smuggling scandals involving some smuggling from Pakistan, where one of the sons of Murtaza Ali was married. Raza Inter College, Hamid Inter College and Murtaza Inter College are three higher secondary schools named after three nawabs.
Prof. Ravindra Khattree, renowned academic statistician, spent some of his early years at Rampur and studied ar Murtaza Inter College and Raza Inter College.
Rampur is located at . It has an average elevation of 88 metres (288 ft).