In 1808, Mahmud's brother and predecessor, Mustafa IV ordered his execution along with that of his brother, the deposed Sultan Selim III, in order to defuse a rebellion. Selim was killed, but Mahmud safely hid and was placed on the throne after the rebels deposed Mustafa. The leader of this rebellion, Mustafa Bayrakdar , then became Mahmud's vizier and took the initiative in resuming reforms that had been terminated by the conservative coup of 1807 that had brought Mustafa IV to power. It was not long before the vezir was killed by rebellious Janissaries in a fire, however, and Mahmud was forced to temporarily abandon the reforms.
Later in his reign, Mahmud's efforts at reform were more successful. His most notable achievement was the massacre of the Janissary corps in 1826. Most of his reforms were not so successful, however, and he was confronted in 1821 with a major rebellion in Greece. Following the Great Powers' intervention which resulted in the Battle of Navarino in 1827 and a Russo-Turkish War in 1828–9, Mahmud was forced to grant Greece its independence in 1832.
Mahmud appears to have been unable to effect the reforms he desired in the mode of educating his children, so that his son received no better education than that given to Turkish princes in the harem. His son Abd-ul-Mejid succeeded him.
Late in his reign, Mahmud became involved in disputes with his ambitious vassal Mehemet Ali, Wali (Governor) of Egypt. Mahmud had enlisted Mehemet Ali's help in suppressing the rebellion in Greece, but had not paid the promised price for his services. In 1831, the Wali declared war, and managed to take control of Syria and Arabia by war's end in 1833. In 1839, Mahmud resumed the war, hoping to recover his losses, but at the very time he died, the news was on its way to Constantinople that the empire's army had been signally defeated at Nezib by an Egyptian army led by Mehemet Ali's son, Ibrahim Pasha.
When he died from tuberculosis in 1839, his funeral was crowded by throngs of people who came to bid the sultan farewell.
|Ottoman Sultan||Succeeded by: