Much of Karabagh in ancient times lay in the ancient Armenian province of Artsakh, on the eastern edge of the Armenian plateau. Its people converted to Christianity along with the rest of Armenia in the 4th century A.D., and from that time many churches and monasteries were established. For centuries, Artsakh (like the rest of Armenia) faced foreign invasions and occupations, but the mountainous terrain allowed for a good deal of local autonomy even in the worst of times. By the late medieval era, a system of autonomous Armenian lords of small principalities, called "melikates," arose. Only in the second half of the 18th century did a Muslim feudal principality, centered in Shushi, emerge in Mountainous Karabagh, and lead to an influx of Turkic and Kurdish tribesmen. In the 19th century, the Russian Empire seized control of the region, and after the onset of Soviet rule in the 20th century; Mountainous Karabagh was placed under the control of the Soviet Republic of Azerbaijan, but with its borders manipulated so that they were no longer directly contiguous with those of the Soviet Republic of Armenia.

Soviet rule allowed the Azerbaijani masters of the ostensibly autonomous Karabagh republic to assert their dominance over the local Armenians politically, economically and culturally. Protest was in vain, and Armenian demographic dominance declined from over 94 percent to roughly 75 percent by the end of the 1980s. At this time, the crumbling of the Soviet Union inspired the Karabagh Armenians to appeal for Karabagh's governance to be transferred to Soviet Armenia. Demonstrations by Armenians both in Karabagh and Soviet Armenia led to violent reprisals in various parts of Azerbaijan. The worst was in the industrial city of Sumgait, where several hundred Armenians were killed in pogroms in February 1988. Soon, an Azerbaijani economic blockade of Karabagh and the forcible deportation of Armenian villagers with the assistance of Soviet forces gave rise to armed clashes, as Armenians resisted. Over the next two years, threats and attacks against Armenians caused the several hundred thousand Armenians living in Soviet Azerbaijan to flee to Armenia, Russia and Central Asia. Azerbaijanis living in Armenia fled to Azerbaijan and elsewhere.

Out-and-out war began in 1991. After Azerbaijan revoked the autonomous status of the Region of Mountainous Karabagh, the local Armenians in turn held a referendum for independence, which was formally ratified by a newly elected Nagorno-Karabagh parliament in January 1992. Despite several reversals, the Karabagh Armenians emerged victorious, having taking control of most of the territory of the former autonomous region, with the exception of some northern areas remaining under Azerbaijani control. Territory surrounding Karabagh was also occupied by Armenians to provide for a buffer zone against future attacks, and this displaced hundreds of thousands of Azerbaijanis. Several tens of thousands died on both sides during the active period of conflict. A ceasefire agreement was signed in May 1994; it has remained unbroken until today, despite minor incidents. Discussions are predominantly continuing within the framework of the Minsk Group of the Organization for Security and Cooperation in Europe (OSCE, formerly CSCE).