Arabs, Mongols and Turks
By the 8th century the Arabs had already built the Dome of the Rock in Jerusalem and conquered most of North Africa, so definitively grabbing Albania in 705 proved to be a pretty straightforward excursion. The pragmatic Albanian king was understandably happy to swap certain death and loss of his kingdom for a nominal conversion to Islam, and the promise to guard his northern borders against Khazar raiders - something he'd been doing anyway. Despite the official switch to Islam, the Albanian church was allowed to keep functioning. All in all, nothing much seemed to change for several decades. Then in 750 almost the entire Arab ruling family was massacred by the usurping new Caliph Abu Abbas. His aggressive new 'Abbasid' dynasty increased taxes to pay for a new capital (Baghdad), turned the screws on non-Muslims and generally started making themsehes unpopular. In Azerbaijan the result was a series of rebellions, of which by far the most sustained and celebrated was Babek's Khuramid Movement. Today Babek is hailed with romantic nostalgia as a Robin Hood-style crusader for the oppressed. Though Babek was eventually executed in 838, low-key struggles continued for most of the century.
Seljuks and Atabeks
By the late 10th century Arab power was finally waning and Albania had fizzled out into a series of disparate fiefdoms - notably 'Aran' (based on Tartar), Shirvan (at Shamakha) and the Shaddedid dynasty of Ganja. The 11th century saw a large-scale influx of the Muslim Oguz Turks under the powerful Seljuk dynasty who rapidly came to control most of the Middle East, eclipsing the Arabs.
The foremost Seljuk leader was Alp Arslan whose interest in the Caucasus was widened by his favourite Georgian wife. Under his enlightened rule Azerbaijan benefited from strong but decentralized government which permitted a degree of free trade outside feudal tribute rule while allowing the continued autonomy of the regional principalities. Islam's progress continued, not by force but force of numbers thanks to the continuing arrival of Turkic immigrants who form the basis of today's ethnic Azeris. Later Seljuk leaders were less adept and with the help of a newly self-confident Georgia, the regime was toppled at the battle of Didgori (1121).
Georgia was entering her Golden Age and under Georgian protection the multiracial, cultural and artistic boom extended to the Azeri principalities too. This continued after the 1150s when the principalities formed a confederation under Shamseddin and his 'Atabek' dynasty, though later rulers fell out with the Georgians who marched back into Azerbaijan a few times between 1185 and 1211 to 'maintain order'. Durig this period many great artists and poets gained prominence notably Nizami Ganjavi, the national literary icon whose statue today adorns almost every Azeri town.
Mongols and Turks
Unwashed, unshaven and drunk, the Mongols were about as welcome as a busload of football supporters at the Ritz. And they did even more damage. Thanks to two revolutionary inventions - stirrups and trousers - Mongols were able to ride their horses across huge distances without genital discomfort. They used this new-found freedom to smash and grab anything they found from Samarkand to Budapest. Azerbaijan was just one of many places utterly devastated by several waves of Mongol and related nomads starting in 1225 with the Turkmens who had got out of the way when they heard the 'real' Mongols were on their way. Cities were razed, crops burnt, populations massacred and irrigation systems destroyed where leaders refused to surrender quickly.
The Mongols' barbaric phase was enough to completely kill the Golden Age. But within a few decades they had mellowed noticeably. Genghis Khan's sons maintained and expanded his empire but thereafter it was split among the likes of Kublai Khan who moved to China where he'd rather build pleasure domes than go to the office for a hard day's massacring. The Iranian chunk of the Mongol empire (including Azerbaijan) fell to Hulugu Khan's II Khanid dynasty after 1250, though Hulugu himself was too busy in Iraq to care much about what happened in Baku. The Azeri lords had periods of recovery in which to bicker amongst themselves before renewed attacks from different Mongol groups (Golden Horde in 1319 and 1382, Timur in 1380 and 1386). Timur, known also as Tamerlane (Timur-the-lame), ransacked even places such as Nakhchivan and Qazax which had survived the earlier raids. On returning to central Asia he scared away much of that region's nomadic Turkic/ Turkmen population who drifted east into Anatolia (Turkey) and Azerbaijan.