Montenegro resisted the rule of the Ottoman Turks, maintaining its independence and playing off its powerful neighbors against each other. Montenegro was recognized as an independent and sovereign principality by the Great Powers of Europe assembled at the Congress of Berlin on July 13, 1878.
During World War I, Montenegro fought on the side of the Allies but was defeated and occupied by Austria. Upon Austrian occupation, the Montenegrin king, King Nikola I, and his government went into exile. In late 1918, an Assembly met in Podgorica, and under the eyes of the Serbian army, deposed King Nikola and declared unification with Serbia. The government of Montenegro in exile denounced the Assembly's action, to no avail. From 1919 to 1941, Montenegro was part of what became known as the Kingdom of Yugoslavia, despite armed resistance in the early 1920s to rule from Belgrade.
When Yugoslavia was invaded and partitioned by the Axis powers in April 1941, Montenegro was appropriated by the Italians under a nominally autonomous administration. While some Montenegrins sided with Italy, motivated by antipathy against past rule from Belgrade, the Partisan Revolt in Montenegro began early, on July 13, 1941, and initially scored impressive successes against the Italian occupiers. Throughout World War II, Montenegro served as an effective base and refuge for Tito's Partisans. After the war, Montenegro was granted the status of a republic within Yugoslavia.
The breakup of the Yugoslav federation after 1989 left Montenegro in a precarious position. Between 1991 and 1992, Slovenia, Croatia, Bosnia and Herzegovina, and Macedonia all seceded from Yugoslavia. On April 27, 1992 in Belgrade, Serbia and Montenegro joined in passing the Constitution of the Federal Republic of Yugoslavia.
Though Montenegro reaffirmed its political attachment to Serbia, a sense of a distinct Montenegrin identity continued to thrive. In March 2002, the Belgrade Agreement was signed setting forth the parameters for a redefinition of Montenegro's relationship with Serbia within a joint state. On May 21, 2006, the Republic of Montenegro held a successful referendum on independence and declared independence on June 3.