In 1878, Austria-Hungary unilaterally occupied the Ottoman provinces of Bosnia-Herzegovina and Novi Pazar, but the Ottoman government contested this move and maintained its troops in both provinces. The stalemate lasted for 30 years (Austrian and Ottoman forces coexisted in Bosnia and Novi Pazar for three decades) until 1908, when the Austrians took advantage of the political turmoil in the Ottoman Empire that stemmed from the Young Turk Revolution and annexed Bosnia-Herzegovina, but pulled their troops out of Novi Pazar in order to reach a compromise and avoid a war with the Turks.