CaliphHarun al-Rashid (the father of the two brothers) had foreseen that upon his death there would be a struggle between the two for succession to the Caliphate (the first born succession concept used in Christianmonarchies was not prevalent in Islam). Thus he decreed that al-Amin would rule the Abbasid Caliphate until his death, while al-Ma'mun acted as viceroy of Khurasan province in Eastern Iran. Then al-Ma'mun or one of his sons would succeed al-Amin as caliph, and in turn be succeeded by someone chosen by al-Amin.
Naturally such a scheme, well-intentioned as it was, was doomed to fail. Both brothers were influenced by their viziers, Fadl ibn al-Rabi and Fadl ibn Sahl respectively, into attempting to claim power. Ultimately al-Amin declared that his sons would reign as Caliphs after he had died, even going as far as to seize the documents binding the brothers to the agreement from the sacred city of Mecca. Al-Ma'mun was much angered by this and prepared for war, his vizier sending a force to defend the key frontier stronghold of Rayy, between the Zagros and Elburz mountain ranges. Meanwhile, al-Amin sent an army out to destroy his brother, which left Baghdad on March 14, 811.
Leaders
Al-Amin's army (divided by the numerous tribes within it) was led by Ali ibn Isa ibn Mahan, the former governor of Khurasan, who had been ousted by Harun. Al-Ma'mun's army was led by Tahir ibn Husayn, a Persiannoble with some claim to one of the many mountain principalities which were nominally vassals to the caliphate.
Size of Forces
Ali's army was "the largest and best-equipped" in living memory, numbering perhaps as many as 50,000. Tahir's contained about 5 thousand at best, however, it contained a high proportion of cavalrymen, whereas Ali was relying mostly on infantry.
Battle
Fearing what the citizens would do to rid themselves of his force if he chose to remain within Rayy's walls and defend against a siege, Tahir led his army along the road towards Baghdad until the intruders were in sight. After an uneasy night, Ali's force made an initial charge, which was followed by a brief truce and unsuccessful negotiations, in which Tahir's envoy reminded Ali of the solemn agreements al-Amin had torn up. Then the main battle began, with a lightning attack force of 700 Khwarazmians, backed by archers, sent to smash the centre of Ali's army, and if possible destroy its command structure. This approach was very effective, swiftly resulting in the death of Ali. How he died is not perfectly clear; one version has it that he was a victim of an arrow-storm sent by Tahir's Bukharan archers ahead of the attack. Another version claims that he was felled from his horse by a soldier named Dawud Siyah ("Black David")- again possibly with an arrow- but not killed. Tahir ibn al-Taji (not related to the commander Tahir) then approached him and asked if he was really Ali ibn Isa, following which he killed him in single combat. In either case, when he was killed his army scattered in all directions.[1]
"The Battle of Rayy marked the turning point in the military tactics of the Period.The large infantry army was defeated by a smaller cavalry force. This may have marked the end of the large armies of foot soldiers which were typical of the much earlier Islamic warfare and the superiority of the smaller groups of mounted men, either armored spearmen or mounted archers."[2]
Aftermath
Tahir ibn Husayn recognised his opportunity and, without awaiting further instructions, took his almost-undamaged army on to Baghdad. After a year-long siege, Baghdad fell and al-Amin was killed.