By the beginning of the 10th century AD, little was left of the once mighty and successful Abbasid empire, so recently the scene of the Golden Age of Arab cultural achievement. This is what had happened:

The Samanid Mausoleum, possibly that of Ismail Samani, in Bukhara,Transoxiana (modern Uzbekistan)
The East
Khorasan and Transoxiana had been ceded to Tahirids, conquered by Saffarids, and then reconquered by the Samanids (874-1005) - who recognised the caliph, but only as a religious figure. The Samanids' power extended also into Kerman, although the Saffarids retained Seistan. Their capital at Bukhara attained a splendour comparable with the great days of Baghdad under al-Mamun. Helped by its crucial position on the Silk Route, agriculture, commerce and industry flourished. An indigenous Persian renaissance was under way: leading figures included Ibn Sina (Avicenna to the west) who was born near Bukhara and was educated in the Samanid capital before eventually finding his way to the Buyid court. And Firdowsi, author of the Shahnameh (Book of Kings), was inspired by renewed interest in the Iranian past and began his great epic around 977 in the Samanid court.
The Ghaznavid Empire at its greatest extent
By the end of the 10th century, though, the Samanids had lost power to two Turkic dynasties:
The Ghaznavids
The Ghaznavids were centred in Afghanistan and northern India - and were looking to expand towards Iran. In 999, the Samanid army was completely defeated at Merv by Mahmud, former leader of the Samanids' own army of Turkish slaves. During their short supremacy they conquered most of Iran and much of India. They were Turks, but eager to pick up on Persian culture (Firdowsi flourished under his patronage and dedicated the Shahnameh to Mahmud). There were supposedly 400 poets attached to his court. He accepted the religious authority of the Abbasid caliph. Mahmud ruled from 998 to 1030, succeeded by his son Ma'sud (1031- 1041). But in 1040 they were defeated by the Seljuqs, another Turkish power. The Ghaznavid empire continued to flourish for another 150 years, but was henceforth confined to Afghanistan and India, having lost control of Khorasan.
Remains of the Ghaznavid palace at the winter capital of Lashgari Bazar, Afghanistan
The Qarakhanids
The Qarakhanids (c 992 - 1212) at the same time were taking over Samanid territory further north in Transoxiana. Both groups had already accepted Islam. The Qarakhanids were keen to emphasise their Turkish roots, and to put Turkish writing on a level with Arabic and Persian. Most famous is the Kutadgu Bilig ("What a ruler needs to know") by Yusuf of Balasaghun - originating a genre which led to Macchiavelli's Prince. Very little remains, alas, of the architectural and artistic achievements of these two Turkic peoples.
Further north and east lay the lands of the Oghuz Turks - their borders were ill-defined, and they appear to have been a fluid confederation of pagan nomadic Turkic peoples. In 965 they defeated the Khazars, who had previously maintained a sort of buffer between the Muslim and Byzantine lands to the south and west and the Oghuz peoples to the north and east. Around 985 an Oghuz Turkish military leader quarrelled with his overlord and moved west with his family and supporters into Transoxiana, and from there into Khorasan. His name was Seljuq.
The Caspian highlands
In the area around the Caspian Sea, the most powerful were the Zaidi rulers of Tabaristan, joined by smaller princes with ambitions to establish independent dynasties: the Sajids had already done this successfully in Azerbaijan (between 8889 and 929). Even the Buyids, who originated from this area, never conquered them.
The South
Between the desert and the Zagros, Abbasid governors claimed as much independence as they could get away with. The caliphs' actual power - dependent on Turkish or Iranian troops - was largely confined to Mesopotamia, where it was being constantly threatened and contested.
The West
In the west - North Africa and Egypt had broken away. The Qarmatis had taken Syria and Arabia. Elsewhere outside Iraq and the environs of Baghdad, local dynasties were staking their claim. Only the caliphate itself somehow maintained its prestige - long after the Abbasids had lost physical power, their successors seemed to need the disempowered caliphs to maintain the fiction of Islamic unity.
The time seemed right for the emergence of a new power - from an unexpected direction. But their period of hegemony was to be comparatively brief - an interlude of revived Iranian rule between the Arab and Turkish domination.
The Buyids
The Buyid dynasty of native Iranians (Dailamites) took over control of Iraq and most of the Iranian plateau during the early years of the 10th century AD. The family originated in the mountains south of the Caspian - which had resisted Islam for almost two centuries before succumbing to the influence of Shi'i Zaidis (many of whom had fled there for refuge). Ali ibn Buya and his brothers - who started off as "hired guns" for the founder of the Ziyarid dynasty Mardavij - ended up conquering the most important parts of the Abbasid empire - though they continued to acknowledge the caliphate. The three brothers split the territories between them - and their dynasty survived until the coming of the Seljuqs. Hasan ruled Media (Jibal), Ali took Fars. Ahmad had Kirman to begin with, but soon expanded into Iraq, profiting from the chaos there. He occupied Baghdad in 945 and won recognition from the Abbasid caliph - who had no power, but was still regarded as the supreme authority of Islam. In 946, however, he deposed and blinded the caliph, replacing him with his own nominee.
The Abbasid rule was over - they were allowed to stay in Baghdad as long as they did not interfere with government. Thus arose the irony of the Buyids position - Shi'i Iranians protecting a Sunni Arab dynasty. Hasan's son (known as Azod al-Dawla) united the three provinces in 980, but dissensions broke out again after his death. The Buyids took no interest in Syria, at this time repeatedly devastated by the revived Byzantine Empire. By 1055 the Buyid dynasty's power was finished. In 1055, the caliph's new protector became the Seljuq leader Toghrul Beg, an enthusiast for Sunni Islam. The Shi'i interlude was over.
Modern bust of Ibn Sina in Tehran
Although the Buyid rulers saw themselves as warriors, they lived in considerable style in palaces well-provided with pavilions, gardens and water-features. During their time Arabic and Persian literature flourished, and, despite their humble origins, they became great patrons of the arts and sciences. Historical writing was encouraged by the massive work of al-Tabari (died 923). A translation of it into New Persian began appearing from 963, sponsored by the vizier at the Samanid court. .The disappearance("occultation") of the Twelfth Imam happened in 940 - inspiring a great deal of Shi'i theological writing. The poet al-Radi (Razi: died 1016) - a descendant of Ali - was famous for his poetry and his compilation of Ali's sayings and writings which became a sacred Shi'i text. There were also geographers, mathematicians, astronomers and physicians - and most celebratedly the philosopher Ibn Sina (died 1037), who'd begun his career under the Samanids in Bukhara. Known in the west as Avicenna, he wrote in both Arabic and Persian, on medicine, astronomy, alchemy, geography, geology, psychology, theology, logic, mathematics and physics. He was also a poet!
The Abbasid family, however, continued to supply the Caliphs, and their position as leaders of Islam was not challenged, despite their political eclipse. And in the 12th century, they staged a come-back. The caliphate actually lasted until 1258, when the very last Abbasid was killed by the Mongol Il-Khan Hülegü.