The struggle for liberation from Turkish rule (Ottoman Empire) and the creation of a Serbian state on the territory of the northernmost Ottoman province, Belgrade Pashaluk, called the First Serbian Uprising, took place at the same time as the Napoleonic Empire in Europe (1804–1813).
The imperial aspirations of France after the great bourgeois (bourgeois) revolution (1789–1799), the country that was the first to abolish feudalism on European soil, stemmed from an effort to assert the state as the greatest power in Europe, but also as a form of reckoning with the states that externally helped the feudal regime in suppressing the bourgeois revolution.
During that time, Serbia did not exist in any international agreement for centuries (1459–1804), as a forgotten country and people under the Turkish Empire, and its diplomatic chances for the restoration of the state did not exist nor were they recognized in the legal system of Europe.
Austria and Russia provided some help to rebuild the Serbian state, but both empires, together with the Kingdom of Prussia, were the target of Napoleon's conquests and actively fought against him. Napoleon also helped his ally, the Turkish Empire, in the fight against Russia (1806–1812) and Serbia by sending his consuls, officers, engineers and artillery to Bosnia (Travnik) and Constantinople. Thus, the whole of Europe found itself in a whirlwind of war and a terrible upheaval. Napoleon already entered Vienna in 1806, Berlin and Warsaw in 1809, and in 1812 he marched directly on Moscow. Russia was therefore forced to withdraw immediately from the war with Turkey, and then an international peace treaty was signed in Bucharest (1812) which, among other things, guaranteed the existence of the Serbian state within the borders held by Karađorđe's army (the Pashaluk of Belgrade and six nahiyas south and east of the Pashaluk).
The Bucharest Treaty was the first international treaty that even mentioned Serbia as a state after several centuries and many saw in it the final "resurrection of the Serbian state".
However, while Napoleon was wintering in conquered Moscow (1812–1813), the Turks took the opportunity to return their territories lost from Russia, contrary to the Treaty of Bucharest, and to defeat Serbia, with a concentric offensive from Bosnia, Niš and Vidin, and to restore the order from before 1804 in the territory of the Belgrade Pashaluk, erasing every trace of Serbian statehood.
Two years later, one of Karađorđe's dukes, Miloš Obrenović, who remained in the country, started after the news of the final fall of Napoleon (1815) to rebuild Serbia and started the Second Serbian Uprising. He referred to the Eighth Point of the Bucharest Treaty and the right to the existence of the Serbian state, demanding its fulfillment. He sent his diplomats to Bucharest, Vienna (Congress of Vienna 1814/1815), Petrograd and Constantinople (as many as seven deputations until 1821). The Congress of Vienna canceled all the results of the Napoleonic Wars (1804–1813) and restored the old Europe. Russian diplomacy believed that the Serbian state should be resurrected according to the provisions of the Bucharest Peace of 1812, but did not manage to put it on the agenda of the congress itself (where Proto Mateja Nenadović tried to present Serbia), but later.
Before the action of the great powers in Constantinople, Miloš Obrenović signed peace with the new Belgrade vizier Marashli Alipasha, a contract which introduced a dual Serbian-Turkish administration in the pashaluka, practically a kind of semi-autonomy (1815), until he received more visible diplomatic help from the outside regarding the fulfillment of the Bucharest Treaty. The country and the people were completely exhausted ("crammed between burned homes") after 11 years of continuous war. It was necessary to at least "put two fires through the chimney", that is, to survive two winters in peace so that "the people can feed themselves with bread because they are dying of hunger as well", concluded the leader of the Second Uprising. The pashalu of Belgrade had 12 nahijas and Serbian princes (managers) were placed at their head who managed Serbian affairs, while Turkish elders were in charge only of Turkish affairs. The administrator of the entire pashaluka was the Belgrade vizier, and Miloš Obrenović took the title knez ("prince") or "serbian prince" to distinguish himself from the princes of Nakhi. And court affairs are strictly separated into Serbian and Turkish.
Finally, only in 1826, with the Akerman Convention, did Russia remind Turkey to fulfill the complete Bucharest Peace of 1812. The fifth point of the Akerman Treaty referred to Serbia, that is, its rights from the Eighth Point of the Bucharest Treaty. Turkey received the obligation to send a Hatsherif to Serbia within 18 months with confirmed rights to internal autonomy and borders from 1812. As it did not do so, Russia went to war against Turkey in 1828 and arrived within reach of Constantinople in September 1829. A new treaty was signed in Jedren in which, under the Sixth Point, Turkey was forced to confirm Serbia's rights within a month with a special hatisherif (with the sultan's signature) and to deliver that document to both Belgrade and Petrograd. The so-called First Hartisherif arrived in Serbia within the prescribed period (1829), but he only declaratively confirmed Serbia's right to statehood, based on previous treaties, without any closer provisions. Dissatisfied with that act, Russia forced Turkey to issue a new decree declaring the Principality of Serbia as a hereditary monarchy, with complete internal administration and independence, within the borders of 1812, from which the civilian Turkish population will be evicted, with detailed provisions.
Finally, in December 1830, at a great ceremony in Belgrade (on Tašmajdan), the Second Hatisherif was read, with the sultan's signature, by which Serbia became a state (Principality of Serbia), and with a special berat, Miloš Obrenović was confirmed as the hereditary prince of the new state. The Belgrade vizier Husein Pasha, as the previous administrator of the pashaluka, clothed the Serbian prince with a special ruling hervania (cloak), as the man to whom he handed over the administration of the former Turkish province, which became a new state on the map of Europe. The day before that event, Miloš wrote to his friend Jovan Gavrilović in Vukovar that "this is more, my love, when it is over, then we can say that there is a Serbian state in Europe". The Turkish civilian population was given a deadline of one year to move out of Serbia, and only six symbolic Turkish garrisons remained in the country in six fortresses ("imperial cities"): Belgrade, Šabac, Smederevo, Kladovo, Užice and Soko grad (on the Drina). Serbia has retained the obligation to pay a flat annual tax ("tribute") to Turkey in a set amount that will not change, as a Sizeren power, and will keep Turkish flags on fortresses with Turkish garrisons. After reading the documents in both Turkish and Serbian languages, ceremonial cannon shots were fired, and then Miloš was anointed Serbian ruler in the Cathedral Church.
However, the Turkish population did not move out within a year, so they received a new deadline, and Serbia did not receive the borders from the time of Karađorđe (1813), but only the territory of the Belgrade Pashaluk. Once again, upon the intervention of the great powers, the Porte undertook to issue the Third Hatisherif (1833), which returned six nahijas outside the Pashaluk to Serbia: Krajina with Ključ (Negotin), Crna Reka (Zaječar), Aleksinac with Raznje (Aleksinac), Kruševac nahija (Kruševac), Stari vlah (Raška and Studenica) and Jadar and Radjevina (Loznica). These were the borders of Serbia at the time of the signing of the Bucharest Peace Treaty in 1812. After that, an official demarcation was made with Turkey and Austria, and from 1830 there was already freedom of religion and the Serbian administration completely took over the job from the Turkish one. By 1835, feudalism was abolished, and in 1838, Serbia received a constitution that introduced a legal order and limited the prince's absolute power. The land that was obtained by abolishing the spahiluk was allocated to the peasants who till then cultivated it and now became free peasants, with guaranteed private property. It was the biggest agrarian reform carried out in Serbia in the last two centuries.
After France, Serbia was the first country in Europe to abolish feudalism. She was recognized by all the great powers and immediately opened diplomatic missions at the consulate level.