The territory was lost to Bey Mustapha Bin Youssef who took advantage of the War of Spanish Succession, to besiege the city in 1707. The city fell in 1708.