Azerbaijani SSR was one of the first republic of Soviet Union that faced the problem of refugees and internally displaced persons. The refugees are ethnic Azerbaijanis from Armenia and the internally displaced persons are ethnic Azerbaijanis from Nagorno-Karabakh and the seven adjacent rayons which are controlled by the self-proclaimed Nagorno-Karabakh Republic.
According to the 1979 census, Azeris numbered 160,841 and constituted 5.3% of Armenia's population. Civil unrest in Nagorno-Karabakh in 1987 led to Azeris' being often harassed and forced to leave Armenia. On 25 January 1988, the first wave of Azeri refugees from Armenia settled in the city of Sumgait. Another major wave occurred in November 1988 as Azeris were either expelled by the nationalists and local or state authorities or fled fearing for their lives. Violence took place as a result of ethnic conflicts; in November 1988, 25 Azeris were killed, according to Armenian sources (of those 20 in the town of Gugark); and 217, according to Azerbaijani sources.
Thus, in 1988–91 the remaining Azeris were forced to flee primarily to Azerbaijan. It is impossible to determine the exact population numbers for Azeris in Armenia at the time of the conflict's escalation, since during the 1989 census forced Azeri migration from Armenia was already in progress. UNHCR's estimate is 200,000 persons.
According to Azerbaijani government at the time of the ceasefire in 1994 there were about 250,000 Azeri refugees from Armenia. According to the 1998 Citizenship Law they are all eligible for citizenship. By the end of 2001, UNHCR estimated that most of them were believed to have naturalized or be in the process of doing so.
During the Nagorno-Karabakh War, territories constituting the former NKAO region of Azerbaijan and the seven adjacent rayons (some of them partly) were occupied by the Armenian forces. As a result people had to leave their homes. Azerbaijan now has one of the highest numbers of internally displaced persons (IDPs) per capita in the world. The IDPs are presented in all of the 76 administrative districts in Azerbaijan. Initially, most of them lived in tent camps and public buildings such as schools, hostels, and dormitories. Since 2001, the Government increased its efforts to solve IDPs' problems. In 2002, the construction of new settlements started, and by the end of 2007, all tent camps were abolished.
The Government of Azerbaijan with the help of the international community has started drafting a Framework Plan for the Return of IDPs to the occupied regions after the settlement of the Nagorno-Karabakh Conflict (The Great Return Programme).
In 1944, Meskhetian Turks were deported en masse from Georgia to Central Asia by Joseph Stalin. One of the regions they resettled in was Fergana Valley, Uzbekistan. In 1989, interethnic violence occurred there triggering an evacuation of Meskhetian Turks from Uzbekistan. This group of refugees in Azerbaijan numbered about 50,000 people. According to the 1998 Citizenship Law, they are all eligible for citizenship. By the end of 2001, UNHCR estimated that most of them were believed to have naturalized
According to State Committee of Republic of Azerbaijan for Refugees and Internally Displaced Persons, there were 603,251 IDPs in Azerbaijan in March 2009. The majority live in and around Baku, as well as in Sumgayit. Significant numbers of IDPs also live along the central-southern route of Füzuli–Aghdam–Agjabedi–Barda–Mingechevir–Ganja, the northern route of Shamakhi–Ismailli–Gabala–Sheki and the southern route of Sabirabad–Saatli–Imishli–Beylagan.
Although relations between IDPs and the local population are generally amicable and there is a high level of tolerance among the local population, there are instances of conflicts arising due to the special status of IDPs (such as privileged access to employment, government financial assistance, free health services and property ownership privileges).