At the beginning of the 11th century AD, The world of the Oghuz (aka Ghuzz) Turks, occupied much of modern Kazakhstan, stretching between the Khazar empire to the west (north of the Caucasus and the Black Sea) to the territory of the Qarakhanid Turks east of the Syr Darya (Jaxartes). In simplest terms - the steppe lands surrounding the Aral Sea. They were nomadic - living off their herds of camels, horses and sheep. Like the Parthians of old, they fought from horseback using bows and arrows. For some centuries they had raided the Muslim lands to the south, and been raided by them - particularly for prisoners then trained to fight as slave warriors (known as ghulams or mamluks) for the armies of the Abbasids, Samanids and other dynasties. Oghuz who had converted to Islam were usually known as Türkmen - though those who disliked them still referred to them as Oghuz or Ghuzz.
In the Islamic world the Qarakhanids had moved westwards into Transoxiana, ousting the Samanids. The Ghaznavids (former ghulam themselves) had moved into Khorasan and Seistan, ousting the Samanids and Saffarids. The Iranian Buyids still dominated the weakened Abbasid caliphate in western Iran and Mesopotamia. And numerous other smaller dynasties with an eye to the main chance had staked their claims (or were trying to) wherever a weakness appeared.
These Turkish Islamic dynasties were wealthy and refined - and great patrons of the visual arts and literature. Along with Ibn Sina and Firdowsi should be mentioned Yusuf Khass Hajib, who wrote a splendid book on court etiquette in Qarakhanid Turkish. The Ghaznavids modelled themselves on the Iranian Samanids whom they'd ousted - and spoke Persian and Arabic at court, not Turkish.
The Seljuqs
According to the later accounts, in the late 10th century, a leading Oghuz family, led by Seljuq, fell out with their Khazar overlords, and migrated eastwards, settling at Jand in Transoxiana on the Jaxartes (Syr Darya). Soon they quarrelled with the local Oghuz chieftain (though the territory was still nominally ruled by the Samanids) and established themselves as leaders. For reasons unclear, the family converted to Islam. Seljuq died - in 1009 (aged 107 according to tradition) and his family and its followers began exploiting the rivalries between Qarakhanids and Ghaznavids - providing help for whichever side seemed more advantageous at the time. As nomads, they were always in need of pasture for their animals, on which their lives depended.
In the 1030s conflict further east, and the quest for pasture forced many Oghuz, led by Seljuq's family, to move down into Khorasan, Ghaznavid territory, provoking confrontation. In 1040 at Dandanqan near Merv, Seljuq's grandsons Chagri Beg and Toghrul Beg unexpectedly defeated a much larger Ghaznavid force (which included elephants) led by the Ghaznavid shah Masu'd. Two years later they crushed the army of the Yabghu, chief of their rivals among the Oghuz - ensuring Seljuq supremacy. They swiftly extended their power into Transoxiana and Iran, inaugurating the Great Seljuq empire. The Ghaznavids were left with only Afghanistan and their north Indian territory.
Driven by pressure from the east, and inspired by the Seljuq success, there now began a migration of Türkmen down on to the Iranian plateau. The two movements joined forces under Seljuq leadership. Nishapur, Rayy, Hamadan, Isfahan and Mosul fell to them, with comparatively little bloodshed. Of Seljuq's three grandsons (sons of his son Mikail), Chagri seems to have remained in Khorasan, while Toghrul led the migration westwards: the capital also moved - from Nishapur to Rayy to Isfahan. Qavurt took Kirman for himself [see below]. Finally, in 1055, Toghrul, responding to a call by the Abbasid caliph to free them from the Shi'i Buyids, captured Baghdad . Toghrul soon became the champion of Sunni Islam, as sultan and Amir al-Muminin (Commander of the Faithful).
Alp-Arslan (1063 - 1073)
During the conquest of Iran and and Iraq the various factions of the Seljuq family had quarrelled continually among themselves - it was important for Toghrul to ensure strong central authority and unchallenged military leadership for his successor. After some problems, the choice fell on Alp-Arslan, son of Toghrul's brother Chagri, who was duly recognised as sultan in 1063, with the approval of the Abbasid caliph. Alp-Arslan was helped considerably throughout his reign, as was his successor Malik Shah (1073-1093), by his brilliant vizier Nizam al-Mulk (1019 - 1092). Nizam al-Mulk was an Iranian from Khorasan who began his long career at the Ghaznavid court: his background encouraged him to see himself as representing the civilising influence of the Iranian governing class. He'd played an important part in securing the succession of Alp-Arslan and became his trusted vizier, responsible for administration of the whole empire - including leading military expeditions.
Ani Cathedral. Completed 1001. Turned into a mosque in 1064. Photo AMW
Alp-Arslan's successful rule - helped by his choice of vizier - was based on five policies:
1 The Turkmen who might have proved troublesome were distracted by being allowed, or even encouraged to raid Christian lands in Anatolia and the Caucasus, and Shi'i territory ruled by the Fatimids in Syria. Alp-Arslan paved the way for them in 1062/3 by invading Armenia. An Armenian Christian, Aristakes, was an eye-witness to the terror unleashed, including the capture of Ani (although Aristakes says Ani deserved it for its godless behaviour):
Now the [Seljuq] king came with many myriads of armed troops and entered our land, spreading dread and terror among those far and near. The armed [Seljuq] troops poured into the city like the foaming billows of the sea. Putting the Persian sword to work, they spared no one.One could see there the grief and calamity of every age of humankind. For children were ravished from the embraces of their mothers and mercilessly hurled against rocks, while the mothers drenched them with tears and blood. Father and son were slain by the same sword. The elderly, the young, priests and deacons also died by the same sword. The city became filled from one end to the other with bodies of the slain, and [the bodies of the slain] became a road. From the countless multitude of the slain, and from the corpses, that great stream which passed by the city became dyed with blood. Wild and domesticated beasts became the cemeteries of those corpses, for there was no one to cover over the bodies of the slain with the needed earth, no one to bury them. The lofty and beautiful palace was burned because of the injustices committed within it.
Aristakes History: About the Sufferings Visited Upon Us by Foreign Peoples Living Around Us, Chapter 24
2 He established that his army was invincible - but that was prepared to show mercy to rebels who submitted.
3 He let local families (Sunni or Shi'i) continue to rule around the fringes of his empire - in Fars, Iraq, the Caucasus and the Caspian regions. Members of his own family, who might otherwise have challenged him, governed provinces of his empire. In Kirman, a branch of the Seljuq family established a completely independent dynasty, descended from his elder brother Qavurt. The Kirman Seljuqs reigned there for 140 years.
4 He appointed an heir early - so as not to have the problems that accompanied his own succession. He was Malik Shah - although he wasn't the eldest son.
5 He made efforts to keep on good terms with the Abbasid caliph (al-Qai'im), though he never actually visited Baghdad. Nizam al-Mulk's daughter married the son of the caliph's vizier, while Alp-Aslan's own daughter married the caliph's son and heir (later caliph al-Muqtadi 1075 - 1094).
The move westward
Alp-Arslan had originally had no quarrel with the Byzantines, and had wanted to coexist with them. He never supposed that his Seljuq forces would be able to confront the mighty Byzantine empire - which the Arabs had been unable to penetrate. He did however consolidate his western frontier early in his reign by attacking Armenia and Georgia (with devastating effects - see above). This move, however, was motivated mainly by his wish to control the renegade Türkmen bands, many led by members of his own family, who were raiding deep into Byzantine territory in Anatolia - and worrying the emperor Romanus IV Diogenes. The chain of prosperous Christian cities (from Diyarbakir through Edessa to Antioch) was threatened, and Romanus sent an army to northern Syria to protect them. A stalemate led to a truce in 1070 - though Arslan had no real control over the Türkmen raiding parties.

Panoramic view of the site of the Battle of Manzikert in eastern Turkey. Photo www.livius.org
Manzikert 1071
Alp-Arslan was astonished to hear in the spring of 1071 that Romanus was leading a huge but ill-disciplined multinational army (some sources say between 200,000 and a million, including many Turkish mercenaries) towards Armenia. A pitched battle at Manzikert (Malazgird) resulted in total disaster for the Greeks - and the capture of Romanus himself. Alp-Aslan - who'd actually tried to avoid the battle - let Romanus go in return for the promise of large ransom. But before he could pay it, Romanus was deposed and blinded by a rival faction in Byzantium. He died as a result.
Armenia became Muslim as a consequence of Manzikert, and Anatolia now lay wide open to Turkish exploitation - led by Suleiman and his brother Mansur, sons of Alp-Arslan's uncle Qutlumush, who'd opposed his nephew's succession but had been eliminated by Nizam al-Mulk in 1064. Suleiman's branch of the family - always hostile to Alp-Arslan's family - were eventually to become sultans of their own Seljuq empire, the Sultanate of Rum (Rum = Rome = the Greeks, former rulers of Anatolia). On the eastern frontier, relations with the Ghaznavids remained settled - as also with the Qarakhanids, for the most part. But when Alp-Arslan crossed the Oxus to calm tensions with a show of strength in1072 he was killed by a local fort-commander. The Qarakhanids then tried to attack in turn, but were stopped by the new sultan, Alp-Arslan's 18-year-old son, Malik Shah.