Despite these setbacks, with a new modern army, Sultan Mahmud initiated a campaign of recentralization in the empire which saw the submission of derebeys and Ayans to central authority.
In 1826, he orchestrated the Auspicious Incident, in which the Kapıkulu were forcibly abolished and many of its members executed, paving the way for the establishment of a modern Ottoman army and further military reforms.
Mahmud also made sweeping changes to the bureaucracy in order to reestablish royal authority and increase administrative efficiency, and oversaw a reorganisation of the Ottoman foreign office.
A version by the 19th-century Ottoman historian Ahmed Cevdet Pasha gives the following account: one of his slaves, a Georgian girl named Cevri, gathered ashes when she heard the commotion in the palace surrounding the murder of Selim III.
By this time one of the leaders of the rebellion, Alemdar Mustafa Pasha arrived with his armed men, and upon seeing the dead body of Selim III proclaimed Mahmud as padishah.
The slave girl Cevri Kalfa was awarded for her bravery and loyalty and appointed haznedar usta, the chief treasurer of the Imperial Harem, which was the second most important position in the hierarchy.
When Emperor Napoleon I of France declared war on Russia in 1811, Russian pressure on the Ottoman border diminished, a relief to Mahmud.
According to the Treaty of Bucharest (1812), the Ottoman Empire ceded the eastern half of Moldavia to Russia (which renamed the territory as Bessarabia), although it had committed to protecting that region.
During the early years of Mahmud II's reign, his governor of Egypt Muhammad Ali Pasha successfully waged the Ottoman-Saudi War and reconquered the holy cities of Medina (1812) and Mecca (1813) from the First Saudi State.
When the Janissaries mounted a demonstration against Mahmud II's proposed military reforms, he had their barracks fired upon effectively crushing the formerly elite Ottoman troops and burned the Belgrade forest outside Istanbul to incinerate any remnants.
[11][12][full citation needed] This permitted the establishment of a European-style conscript army, recruited mainly from Turkish speakers of Rumelia and Asia Minor.
Sultan Mahmud II maintained control of his forces, unfurled the banner of the prophet and declared his intention of taking command of the army personally.
Previous to the first of the firmans, the property of all persons banished or condemned to death was forfeited to the crown; and a sordid motive for acts of cruelty was thus kept in perpetual operation, besides the encouragement of a host of vile delators.
The practice of the Sultan avoiding the Divan had been introduced as long ago as the reign of Suleiman I, and was considered one of the causes of the decline of the Empire by a Turkish historian nearly two centuries before Mahmud II's time.
Mahmud II also addressed some of the worst abuses connected with the vakıfs, by placing their revenues under state administration (see Ministry of Evkaf).
A firma dated 22 February 1834, abolished the vexatious charges which public functionaries, when traversing the provinces, had long been accustomed to take from the inhabitants.
"No one is ignorant," said Sultan Mahmud II in this document, "that I am bound to afford support to all my subjects against vexatious proceedings; to endeavour unceasingly to lighten, instead of increasing their burdens, and to ensure peace and tranquility.
The haraç, or capitation-tax, though moderate and exempting those who paid it from military service, had long been made an engine of gross tyranny through the insolence and misconduct of the government collectors.
The firman of 1834 abolished the old mode of levying it and ordained that it should be raised by a commission composed of the Kadı, the Muslim governors, and the Ayans, or municipal chiefs of Rayas in each district.
Sultan Mahmud II provided a valuable personal example of good sense, and economy, organising the imperial household, suppressing all titles without duties, and all salaried officials without functions.
By attaching them to the public domains, Mahmud II materially strengthened the resources of the state, and put an end to a host of corruptions.
One of the most resolute acts of his ruling was the suppression of the Dere Beys, the hereditary local chiefs (with power to nominate their successors in default of male heirs), which, in one of the worst abuses of the Ottoman feudal system, had made themselves petty princes in almost every province of the empire.
Mahmud II steadily persevered in this great measure and ultimately the island of Cyprus became the only part of the empire in which power that was not emanating from the Sultan was allowed to be retained by Dere Beys.
Following the loss of Greece after the Battle of Navarino against the combined British-French-Russian flotilla in 1827, Mahmud II gave top priority to rebuilding a strong Ottoman naval force.
During his reign, Mahmud II also made sweeping reforms of the bureaucracy in order to reestablish royal authority and increase the administrative efficiency of his government.
While he built upon Selim III's foundational elements of international diplomacy, Mahmud II was the first to create the title of Foreign Minister and Undersecretary in 1836.
It portrays a legend about Aimée du Buc de Rivéry as a young captured French girl who, after spending years in an Ottoman harem, outlives two Sultans and protects Mahmud as his surrogate mother.