Shah Jahan appointed Aurangzeb as the viceroy in 1636 and again in 1650. Chatrapati Shivaji personally invaded Ahmadnagar in 1657 and in 1665. At other times Shivaji's minister and generals attacked Ahmadnagar intermittently. Aurangzeb tried to put an end to the independent kingdom of the Marathas but he never succeeded in this and at last died in Ahmadnagar on 21st of February 1707. Shortly after this the fall of the Mughal power in the Deccan was completed by the revolt of Chin Killich Khan (Nizam-ul-Mulk), the governor of Malwa. Ahmadnagar was one of the parts of the Deccan which became subject to the Nizam and remained in his hands till his death in 1748.
The Rule of the Marathas (1759 to 1817)
After the death of Nizam-ul-Mulk a quarrel issued between his sons, Salabat Jung and Ghazi-ud-din. In this political mess the Nizam's commandant Kavi Jung betrayed the fort of Ahmadnagar to the Peshwa, the minister of the Marathas. War followed between the Nizam and the Peshwas and the Nizam was defeated in 1760 at Udgir. Besides other concessions the Nizam confirmed the grant of Ahmadnagar and Dualatbad and also gave up the greater part of the province of Ahmadnagar. The Nizam was again defeated by the Marathas in 1795 at Kharda. Following the Battle of Kharda, Ahmadnagar fell into the hands of the Marathas.
After the death of Sawai Madhav Rao in 1795, quarrels arose among the Maratha noblemen. In 1797 Daulatrao Sindia took the fort of Ahmadnagar from Baji Rao II, as the price of helping him to raise him to the post of Peshwa. The famous statesman Nana Fadnavis was imprisoned in Ahmadnagar fort in 1797 by Sindia. At last he was released in 1798 but sorely discouraged, Nana Fadnavis died in 1800.
Bajirao Peshwa was continuously harassed by Yashwant Rao Holkar and Daulatrao Sindia. So he concluded a treaty with the British for the safety of his ministership, on 31st December 1802 with the Treaty of Bassein. Now the noblemen had to fight with the British might. Lord Wellesley attacked Ahmadnagar city and captured it. Then he laid siege to Ahmadnagar fort on 9th of August 1803 and captured it on the 12th of August 1803. General Wellesley then returned the fort of the Peshwa soon i.e. in 1803. The Holkars also came to terms with the British. There was widespread disorder in the area due to famine and hundreds were looted, murdered and massacred by the Pindaris. There was a rebellion against the British rule by common people headed by Trimbakji Dengale of Sangamner. The British troops soon brought the circumstances under control with the help of their disciplined soldiers. At last a treaty was concluded with Bajirao Peshwa at Poona by virtue of which the Ahmadnagar Fort was handed over to the English.
British Rule and the freedom struggle (1817 to 1947)
When the British Government took possession of Ahmadnagar much of it was almost ruined. Many former rich areas were depopulated because of famine and continuous fighting between the British soldiers and the freedom fighters. They continued to rise in arms taking resort to villages and the hills and mountains- mostly Parner, Jamgao and Akola areas. The Kolies and the Bhils harassed the British troops intermittently.
During the great freedom Sepoy Mutiny , 1857, Ahmadnagar was a scene of considerable disturbance. The active freedom fighters were about 7000 Bhils under the leadership of Bhagoji Naik. They were active in the hilly tracks and especially in the Parner, Jamgao, Rahuri, Kopargaon and Nasik areas. But at last all these attempts to rise against the British failed and slavery came to stay. By about 1880 it was almost quiet everywhere.
During the nationwide freedom struggle, many of the famous leaders, except Mahatma Gandhi, were kept confined in the Ahmadnagar fort. Jawaharlal Nehru wrote his famous book Discovery of India while he was imprisoned in the Ahmadnagar Fort.
The famous leaders of Ahmadnagar were underground for many days. The veteran leader of Ahmadnagar district, Senapti Pandurang Mahadeo Bapat, was the most fearless and was one of the greatest disciples of Mahatma Gandhi. He carried on the Mulshi Satyagraha bravely and was arrested in 1937. He was kept behind bars till India achieved her independence. Senapti Bapat never cared for anything and was ever prepared to lay down his life in the freedom struggle. India attained her freedom on the 15th of August 1947 and all the brave leaders were released from imprisonment. The flag salutation ceremony took place on the ramparts of the Ahmadnagar Fort at 8 a.m on 15th August 1947 at the hands of Acharya Narendra Dev who was interned in the Fort for a long time during the struggle for freedom.