Mahmud II (Ottoman Turkish: محمود ثانى, romanized: Maḥmûd-u s̠ânî, Turkish: II. Mahmud; 20 July 1785 – 1 July 1839) was the sultan of the Ottoman Empire from 1808 until his death in 1839. Often described as the "Peter the Great of Turkey", Mahmud instituted extensive administrative, military, and fiscal reforms. His disbandment of the conservative Janissary Corps removed a major obstacle to his and his successors' reforms in the Empire, creating the foundations of the subsequent Tanzimat era. Mahmud's reign was also marked by further Ottoman military defeats and loss of territory as a result of nationalist uprisings and European intervention.
Mahmud ascended the throne following an 1808 coup that deposed his half-brother Mustafa IV. Early in his reign, the Ottoman Empire ceded Bessarabia to Russia at the end of the 1806–1812 Russo-Turkish War. Greece waged a successful war of independence that started in 1821 with British, French and Russian support, and Mahmud was forced to recognize the independent Greek state in 1832. The Ottomans lost more territory to Russia after the Russo-Turkish War of 1828–1829, and Ottoman Algeria was conquered by France beginning in 1830.