Maratha ruler Mahadji Shinde entered the land of Sardar Najib-ud-Daula which was held by his son Zabita Khan after the sardar's death. Zabita Khan initially resisted the attack but was eventually defeated by the Marathas and forced to flee to the camp of Shuja-ud-Daula and his country was ravaged by Marathas. The Maratha ruler Mahadji Shinde captured the family of Zabita Khan, desecrated the grave of Najib ad-Dawlah and looted his fort. The principal remaining Rohilla Sardar was Hafiz Rahmat Khan Barech and through him an agreement was formed with the Nawab of Oudh, Shuja-ud-Daula, by which the Rohillas agreed to pay four million rupees in return for military help against the Marathas. However, after Oudh attacked the Rohillas, they refused to pay. Afterwards, the Rohillas were attacked by the neighbouring kingdom of Oudh, who also received assistance from an East India Company force under the command of Colonel Alexander Champion. This conflict is known as the Rohilla War. When Hafiz Rahmat Khan Barech was killed, in April 1774, Rohilla resistance crumbled, and Rohilkhand was annexed by the kingdom of Oudh; most Rohillas either emigrated or started a guerrilla war against the annexation. Warren Hastings' role in the conflict was publicized during his impeachment. From 1774 to 1799, the region was administered by Khwaja Almas Khan, a Meo from Haryana, as representative of the Awadh (Kingdom of Oudh) rulers. This period was particularly tough for the Rohillas, as Almas Khan made every effort to weaken the Rohillas. In 1799, the British East India Company annexed the territory, and started to pay a pension to the family of Hafiz Rahmat Khan Barech. Establishment of Rampur State While most of Rohilkhand was annexed, the Rohilla State of Rampur was established by Nawab Faizullah Khan on 7 October 1774 in the presence of Colonel Alexander Champion, and remained a compliant state under British protection thereafter. The first stone of the new Fort at Rampur was laid in 1775 by Nawab Faizullah Khan. The first Nawab proposed to rename the city Faizabad, but many other places were known by that name so its name was changed to Mustafabad. The Qissa-o-Ahwal-i-Rohilla written by Rustam Ali Bijnori in 1776 provides an example of the refined Urdu prose of the Muslim Rohilla elite in Rohilkhand and Katehr. According to the 1901 census of India, the total Pathan population of Bareilly District was 40,779, while the total population