During the First Serbian Uprising, Serbian revolutionaries held the city from 8 January 1807 until 1813, when it was retaken by the Ottomans. After the Second Serbian Uprising in 1815, Serbia achieved some sort of sovereignty, which was formally recognised by the Porte in 1830.