Karabagh conflict and independence
In 1991 the USSR collapsed and Azerbaijan regained its independence. Incredibly important as this may have been, the whole 1988-93 era is completely overshadowed by the Nagorno Karabagh dispute and war with Armenia. To get a real grasp of the issues and the underlying web of political intrigues you really need to read a small library of books.
The early history of Nagorno Karabagh (Mountain/Upper Karabagh) is too complex and controversial to examine in detail here. In the 18th century the area was predominantly Azeri and site of the Azeri 'cultural capital'at Shusha. However, during the Tsarist Russian era it became increasingly populated with Christian Armenians fleeing Turkish control. By the 1980s the Armenian population formed a majority though substantial numbers of Azeris and some Kurds remained. It still legally remained (and remains) part of Azerbaijan. In February 1988, Armenians started demanding a transfer of Nagorno Karabagh from Azerbaijani to Armenian control. This was a deliberately provocative demand. A convincing theory suggests that Gorbachev had intended to stir up trouble in Karabagh as a smoke screen for humiliating troop withdrawals from Afghanistan. Perestroika or not, how else would an issue so contentious have received major press attention in the notoriously secretive USSR? Tragically things spiralled out of anyone's control. Frightened by the apparent arming of Armenian nationalists (again, unlikely without tacit Russian support), long-term ethnic Azeri residents of Armenia fled to Azerbaijan. Their plight resulted in tit for tat attacks on Armenians in Azerbaijan, possibly by refugees, possibly by agents provocateurs. However, even in the worst violence in Sumgayit, stories abound of Azeri and Armenian friends sheltering one another from the violence. Nonetheless, ethnic Armenians started fleeing to Armenia. The conflict steadily ratcheted itself up to a higher pitch, exacerbated by propaganda. In this the Armenians had an unquestionably stronger hand thanks to a well-organized Armenian diaspora in Western countries and better access and relations with the Soviet leadership.
The last straw for Azerbaijan's faith in the USSR came on 20 January 1990 when Gorbachev sent the Red Army into Baku. This was ostensibly to restore order following severe disturbances in which several Armenians had died. But the killings had been in Sumgayit, not Baku. And they had been over a week before. On arrival the Red Army massacred (by the lowest estimate) a minimum of 130 unarmed civilians, almost certainly more. The horrified citizens blockaded the port to prevent the corpses being taken out and dumped at sea.
But worse was still to come. Over the following three years, Armenian forces progressively advanced into and beyond Nagorno Karabagh. Before each advance there would be a propaganda barrage about how the poor population in this or that village was being subjected to 'Azen terror'. Then the Armenian troops would march in a few days later to the 'rescue'. Azeri citizens were infamously massacred at Hojali The Lachin Corndor separating Nagorno Karabagh from Armenia was also invaded and the population of Kelbajar, boxed in on three sides, was forced to flee across frozen mountain passes to the north. To add insult to injury, once Armenians had occupied a huge swath of Azerbaijan, the USA decided to impose sanctions against Azerbaijan for blockading the Baku-Yerevan railway line. That the Armenians had previously blockaded the railway line to Nakhchivan went apparently unnoticed.
Deal of the century
In the meantime Azerbaijan had been through two changes of government. The original communist 'left over' president, Mutalibov, was forced out and replaced by an elected president, Abulfaz Elchibey, who fled a year later in the face of a military rebellion. His place was filled by the recently drafted parliamentary speaker, none other than Heydar Aliyev the ex-Politburo member who was later confirmed in the position by an overwhelming referendum followed by later election to office. Aliyev turned the tide, preventing further Armenian advances, retaking Horadiz and organizing a lasting ceasefire. The first really good news in a while was the so-called 'Deal of the Century' signed in September 1994, promising a $74 billion dollar oil investment programme. Baku began to swarm with expats and there was a new building boom. When oil prices briefly plummeted to around $12/barrel in 1998-9 things suddenly looked pretty bleak. Oil companies merged frenetically and the whole Caspian oil project was questioned. But a year later optimism had soberly rebounded with the price of crude. After years of prevarication and politico-economic wrangling, work finally began on the multi-billion dollar Baku-Tbilisi-Ceyhan (BTC) Azerbaijan-Turkey oil pipeline in 2003 resulting in another major investment spree. The year 2003 also marked the end of an era, with the death of long-term president Heydar Aliyev. Having passed the baton of presidency to his son Ilham through summer elections described at best as opaque, his death was announced on December 12th. Though criticized abroad, Heydar had been a dominating figure who the vast majority of Azeris respected as the father of the nation, a strong, wily diplomat without whom the future will be a new adventure.