The Mervian dynasty, founded in 1144 at Merv, was the first - and most substantial - kingdom to break away from the Seljuk Sultanate. Their founding ruler Alp Tegin of Merv, earned the title Sultan of Merv after a successful war against the reigning Seljuk Sultan, Qiliq Arslan II in 1150. The dynasty was finally extinguished and absorbed into the territory of the Khwarezm Shahdom in 1200.
The core Seljuk dynasty, dating back to the 1040s, was beginning to peter out a century later. In 1141, the elderly Sultan Arslan III died and was superceeded by his grandson Qiliq Arslan II. He was to rule for 20 years; and that rule was going to be one of deprivation and disaster for the Seljuk cause. In 1144, rebellion stirred up in the Eastern provinces, headed by Turkish nobles of a distant branch of the royal line that dated back to the great Alp Arslan I, victor of Manzikert. Their leader, Alp Tegin of Merv, first made his capital at Shiraz, but marched on Merv, his home city, in 1145. The citizens opened the gates to him; in return for this, he made Merv his centre of operations. By the hundred, discontented Turkmans of the Eastern provinces flocked to his banner. War with Hamadan (the seat of Seljuk government) seemed inevitable.
Seljuk Civil War
War couldn't be further from the mind of the young Sultan in Hamadan, Qiliq Arslan II. As a result, it was only when Alp Tegin dared to advance on the city of Kermenshah that Qiliq Arslan's ministers forced him to take action. This he did, rebuffing Alp Tegin at Kermenshah in 1147 and then again at Sultaniya in early 1148. However, the Sultan's ineffectual nature alienated many of his subjects, which caused a massed desertion of Seljuk forces. Many of these defected to Alp Tegin, who ultimately seized Kermenshah in late 1148. Qilich Arslan, who up until now had had some vague grip of the situation, fell foul to a fit of debauchery and drink. A failed assassination attempt failed to reconcile him to the world of sense; it was only when Alp Tegin laid siege to Hamadan in December 1150 that he was pulled to his senses. The resulting peace negotiations were embarrassing for the once mighty empire, all land east of Sultaniya, including the town itself, was to become the territory of Merv.
The Reign of Alp Tegin
Qilich Arslan II had neglected the Eastern provinces badly during his reign, and it was Alp Tegin's policy to see that these provinces benefited under his governance. The introduction of farming policy and the construction of several universities, notably at Merv, Khorusan and Samarkand, were foremost among his policies. The borderland periphery of his realm however, was in serious need of shoring up - Turkish tribes made regular inroads into the Mervian villages on the borderlands. Alp Tegin, though energetic in his attempts to reform his Eastern defenses was unsuccessful. He died in 1155, of pain induced from the infection of a wound sustained at the hands of a Ghuzz chieftain.
Peace in Merv
Alp Tegin was suceeded by his eldest nephew Sanjar Khosru, who's rise to power involved the assassination of five cousins and three siblings. His reign fully consolidated in 1156 by the assassination of Alp Tegin's youngest son, Yaqoob, he dedicated himself to the peace and glorification of his country. Trade was adopted with neighbours, including many of the Ghuzz tribes and the Qara Khitai Mongols - and in 1160 negotiated a trade agreement with Hamadan. He used this newfound wealth to constructed great buildings in towns such as Herat, Balkh, Samarkand, Bukhara, Khorusan and, of course, Merv. At his death in 1168, his only son, Tuymish followed a similar course, plagued only by the occasional raid from one of the more powerful Ghuzz tribes. At his death in 1175, the Sultanate of Merv was at the height of its wealth.
Collapse from within
1175 proved to be the turning point. A succession crisis between the two twin brothers of Tuymish was resolved only when both were killed the following year by their maternal uncle, Mustapha Iltumish al Baraq of Herat. His rule of 4 years was plagued by uprisings and civil war - and was ended by an invasion of Ghuzz Turks who caught the Sultan napping in Samarkand, sacked the town, castrated the Sultan and left his body hanging from the town gates. Such was the outrage that his successor, the pretender grandson of Alp Tegin, Haseem I, followed the Ghuzz to their encampment and attacked. It was a foolish mistake which cost the life of another Sultan and another blow to the stability of the country. Rashid ibn al Tuymish, the last son of Tuymish, laid claim to the throne, but was betrayed by his own mother who had him captured and sold him to the Khan of the Qara Khitai, who agreed to come and install her on the throne. She reigned as Sultana Aibaka for only 3 months, before she and her Khitan allies were ejected from the capital by popular rebellion. They were replaced by Selim al Bartooq, whose spurious claim to the throne was set aside by moderate minded officials. His reign was to be one of comparative stability for the next 12 years.
Sanjar the Magnificent - The Rise and Fall of the Pretender State
Rise to Power
Typically enough, Sultan Selim died in 1192 with no heirs. Thankfully the family of Alp Tegin provided one in the form of Sanjar, son of Alp Tegin's youngest daughter Ayfal. Suspicions were raised as to the authenticity of this claim - where had this Sanjar, now 40 years of age, been during the Time of Troubles. Sanjar's argument won the day; he claimed that he and his mother had been hidden in the mountains of Afghanistan to escape the rampages of his namesake, Sanjar Khosru. It was true that Sanjar Khosru had been a frightening prospect to any potential contender to the throne, but some were still not sure. Nonetheless, Sanjar assumed his crown with dignity and without disturbance of any kind. The hardy Turkish followers he had brought with him from the empire's periphery had sorted that.
War with Hamadan
His first move was to settle a dispute with the Sultanate of Hamadan over land. The current ruler in Hamadan, Qilich Arslan IV - was the third in a line of rulers who styled themselves as Grand Sultan of Seljuk, a title which had been surrendered effectively by the incompetence of Qilich Arslan II some 50 years earlier. Qilich Arslan IV, however, was a somewhat different personality to his debauched namesake; he was firey, ambitious and extremely intelligent. His dealings with Sultan Selim had been aggressive, but on the whole diplomatic. However, he had succeeded in wrangling Sultaniya and the surrounding area from the failing hands of Selim. Now, Sanjar wanted them back.
Qilich Arslan IV was quick to move in defense of his hard won territories. Being in the centre of an area where conflict was likely, Qilich Arslan put in place many precautions for keeping his unruly neighbours under control. He tricked the Seljuk Prince of Armenia into an alliance which allowed him to hold all of Armenia's finest cities to ransom. To the West, the troublesome Zangids, Ortoqids and Danishmends were more of a problem. Qilich Arslan quickly sorted this too, by asking his erstwhile foe, the Byzantine Emperor, to march against these petty states in exchange for some border towns (which, cleverly, were technically held by the Armenian Seljuks). Then, in combination with his vassal, the Ummayad Caliph, he marched his army to Sultaniya.
Sanjar, however, had got there first, and easily wrested Sultaniya and Kermenshah off the local emir. A man of military genius, Sanjar ordered immediate defenses to be put in place around the Sultaniya area - and ordered a force of Turcomans under his friend and able general, Ibbak al Toqtamish, to probe areas far south towards the Arabian Gulf, in an attempt to frighten the Ummayads.
The Sultaniya Campaign
The precautions worked exactly as planned; for all of his own diplomatic genius, Qilich Arslan IV was too slow in the actual field. The fact that he had been abandoned by his Arab allies had not helped; they had turned back on hearing tales of a Turkish attack on Charax. Though still not outnumbered, Qilich Arslan IV was outwitted by Sanjar's defenses at Sultaniya and his army was defeated. The results of this were disastrous: to the Mervians, Qilich Arslan lost all of the land from Sultaniya to Kermenshah, the Armenian Seljuks seized Tabriz and the Ummayads - after a surprise victory at Fars over Ibbak al Toqtamish, claimed their independence as seized all Qilich Arslan's land up to Kirkuk. Moreover, Alexius IV of Byzantium had annexed the Ortoqids and the Danishmends and beaten the Zangid Emir, Nour al Salih, so completely that he was now effective master of an Empire the size of the one under Theodosius II. And he was expecting land that Qilich Arslan was no longer in a position to give.
Sanjar made a formal peace with the Ummayads in 1194.
1194 was also the year Sanjar chose to look eastwards. There was always some irritating Ghuzz chieftain that needed beating up somewhere in the area, but more importantly, there was old business to settle. In 1190, a pro-Persian Turk by the name of Mehmet Salih proclaimed an independent state around the Aral Sea in defiance of Selim al Bartooq's administration in Merv. Nothing had been done because the Aral Sea was too far away - and the kingdom itself was too small to affect the issue on its own. What worried Sanjar was the sentiment of the nation. A nation of predominantly Persians and Arabs, ruled by a group of violent, bloodthirsty, unpopular Turks. If this pro-Persian state was allowed to exist, then Persians in the Sultanate of Merv - who made up a good half of the population - would flock to the banner of Mehmet Salih. Sanjar knew he could not allow this to happen. Consequently, in 1195, he announced his intention to invade Khwarezm.
This was a diplomatic bungle for a number of reasons. First, it upset the Persians in Sanjar's territory. Secondly, it prompted the Ghuzz Turks to prepare to interfere. Thirdly, it lead to a rush of pro-Khwarezmid propaganda.
Point number 2 did not upset Sanjar very much. On his way north he accosted a large horde of Ghuzz Turks and defeated them suddenly and crushingly in a decisive charge. Another Ghuzz army in the north reaches accidentally strayed across Sanjar's path and was dealt with in a similar way. Sanjar had been raised in a way similar to many Ghuzz peoples - he knew their warfare style and culture inside out and never failed to beat them at their own game.
However, Sanjar never reached Khwarezm. In 1196 he was recalled by his government, who reported pro-Persian revolt across the country. Ghuzz support for the revolt was open; Khitan subsidy was suspected. Sanjar was furious. Marching back down the coast of the Caspian sea, he found a Persian-Ghuzz coalition blocking his path. His army outnumbered theirs quite significantly; the battle did not take long. Whole detachments of men were herded into the sea by Sanjar's cavalry; those survivors had their limbs cut off and thrown into the sea after their comrades. The ringleaders were rounded up, tortured and then dismembered in a similar way to the common soldiers. One of them - a Persian called Bagras Yazdar - admitted under torture that the Khan of the Qara Khitai had been subsidising their army.
Sanjar had been cleverly deceived. Yazdar had, of course, been lying. His plan was to get the Qara Khitai involved in the war. It worked; Sanjar immediately marched his force over the border and burnt a few outposts - catching a royal caravan heading for the Khitan capital and massacring the travellers, stealing thousands of expensive trinkets.
In his capital in Balasagun (modern day Kyrgyzstan), Khan Baguur Chinua II of the Khitans was furious at an unprovoked attack from a former ally. His army mobilised and marched in pursuit of Sanjar, coming to rest on the border. Negotiation began with Khwarezm. Cooperation, Khan Baguur realised, was the only way to bring his Turkish enemy down.
Meanwhile, in Persia, resistance took on an altogether different form. The Persians who had seized power in strongholds throughout the country knew it would be hopeless to engage the invincible Sanjar in battle, migrated in great number to the North. Sanjar arrived at his capital in the closing months of 1196 to find that very little had changed at all. Indeed, it took him only a few weeks to destroy the isolated pockets of rebellion that had stayed. Though the had the opportunity to pursue the main body of rebels, he declined; instead, he set about repairing damage done to his hinterland - as if it were peacetime.
In many respects this was wise; there was no conflict for the next year. Sanjar was able to form up his army and repair his infrastructure. However, so had his enemies. In early 1198 he heard of a great Ghuzz attack to the East. He marched to oppose it - and did so with mixed success. He defeated the Ghuzz on every formal battlefield; however, the Ghuzz were wise to avoid as many formal battles as the could. Constant side-stepping and complex maneuvre exhausted Sanjar's armies.
The Khwarezmid-Khitan force in the north, meanwhile, made piecemeal progress in the Northern provinces, careful not to draw too much attention to themselves. So long as Sanjar was content with fighting the Ghuzz, his forces got weaker as theirs got stronger.
The Final Battle
Sanjar was very confident of himself by this time - as the year 1198 drew to a close, the battered Ghuzz drew away from the border with Merv and back into their Turkman hinterland. Wisely, Sanjar did not choose to pursue. But the tide was already turning against him. In February 1199, Khan Baguur and Mehmet Salih advanced on the Mervian city of Urgangh.
Sanjar was quick with his retribution; the next month, his own force was at the walls of the city by March. A mighty battle was fought before the walls, where Sanjar pressed the attack with daring energy. The battle was bloody - and both sides lost many men - but ultimately a small force of pro-Khitan Ghuzz mercenaries dealt the delivering blow to the Seljuk rear. Sanjar was himself surrounded; allegedly he was the last man to be slain. But the damage was done; Khwarezmid and Khitan alike joined hands around the town, which fell later that week.
Annexed to Khwarezm
Elsewhere, resistance was strong, with cities such as Merv, Herat and Balkh holding out for months against Mehmet Salih's forces. But Seljuk authority was broken; no successor could be found for Sanjar. By the next year, it was all over. Afghanistan fell into the hands of the Qara Khitai, whilst in Persia, Mehmet Salih raised himself to Shah Mehmet I, Ruler of the Khwarezm Shahdom. The fate of his nation was to take quite a different course...