The Principality of Serbia (Serbian: Кнежевина Србија / Kneževina Srbija) was a semi-independent state in the Balkans that came into existence as a result of the Serbian Revolution which lasted between 1804 and 1817. Its creation was negotiated first through an unwritten agreement between Miloš Obrenović, leader of the Second Serbian Uprising and Ottoman official Marashli Pasha. It was followed by the series of legal documents published by the Porte in 1828, 1829 and finally, 1830 — the Hatt-i Sharif.
Despite oppression by the Ottoman authorities, the Serbian revolutionary leaders — first Karađorđe and then Miloš Obrenović — succeeded in their goal of liberating Serbia from centuries-long Turkish rule. Turkish authorities acknowledged the state in 1830 by the charter known as the Hatt-i Sharif, and Miloš Obrenović became a hereditary prince (knjaz) of the Serbian Principality.
At first, the principality included only the territory of the former Pashaluk of Belgrade, but in 1831–33 it expanded to the east, south, and west. On 18 April 1867 the Ottoman government ordered the Ottoman garrison, which had been since 1826 the last representation of Ottoman suzerainty in Serbia, withdrawn from the Belgrade fortress. The only stipulation was that the Ottoman flag continue to fly over the fortress alongside the Serbian one. Serbia's de facto independence dates from this event. A new constitution in 1869 defined Serbia as an independent state. Serbia was further expanded to the southeast in 1878, when its independence from the Ottoman Empire won full international recognition at the Treaty of Berlin. The Principality would last until 1882 when it was raised to the level of the Kingdom of Serbia.
Akkerman Convention (7 October 1826), treaty between the Russian Empire and Ottoman Empire, had article 5 on Serbia: autonomy, and return of lands removed in 1813, Serbs were also granted freedom of movement through the Ottoman Empire. Rejected by Mahmud II in 1828.
^Stanford J. Shaw and Ezel Kural Shaw, History of the Ottoman Empire and Modern Turkey, Volume 2: Reform, Revolution and Republic—The Rise of Modern Turkey, 1808–1975 (Cambridge University Press, 1977), p. 148.