The first conflict between local Bedouin
tribes and Sasanian forces seems to have been in 634, when the
Arabs were defeated at the Battle of the Bridge.
There a force of some 5,000 Muslims under Abu 'Ubayd
ath-Thaqafi was routed by the Persians. In 637 a much
larger Muslim force under Sa'd ibn Abi Waqqas
defeated the main Persian army at the battle of Al-Qadisiyya
and moved on to sack Ctesiphon. By the
end of the following year (638), the Muslims had conquered almost
all of Iraq, and the last Sasanian king, Yazdegerd III,
had fled to Iran, where he was killed in 651.

The Muslim conquest was followed by mass immigration of Arabs
from eastern Arabia and Oman. These new arrivals did not disperse
and settle throughout the country; instead they established two
new garrison cities, at Al-Kufah, near ancient
Babylon, and at Basra in the south. The
intention was that the Muslims should be a separate community of
fighting men and their families living off taxes paid by the
local inhabitants. In the north of the country, Mosul
began to emerge as the most important city and the base of a
Muslim governor and garrison. Apart from the Persian elite and
the Zoroastrian priests, whose property was confiscated, most of
the local people were allowed to keep their possessions and their
religion.

Iraq now became a province of the Muslim Caliphate, which
stretched from North Africa and later Spain
in the west to Sind (now southern Pakistan) in
the east. At first the capital of the Caliphate was at Madinah
(Medina), but, after the murder of the third caliph, 'Uthman,
in 656, his successor, the Prophet's cousin and son-in-law Ali,
made Iraq his base. In 661, however, 'Ali was murdered in
Al-Kufah, and the caliphate passed to the rival Umayyad
family in Syria. Iraq became a subordinate province, even though
it was the richest area of the Muslim world and the one with the
largest Muslim population. This situation gave rise to continual
discontent with Umayyad rule; this discontent was in various
forms.

In 680 'Ali's son al-Husayn
arrived in Iraq from Madinah, hoping that the people of Al-Kufah
would support him. They failed to act, and his small group of
followers was massacred at Karbala',
but his memory lingered on as a source of inspiration for all who
opposed the Umayyads. In later centuries, Karbala' and 'Ali's
tomb at nearby An-Najaf became important centres of Shi'ite
pilgrimage and are still greatly revered today. The Iraqis had
their opportunity after the death in 683 of the caliph Yazid
I when the Umayyads faced threats from many quarters. In
Al-Kufah the initiative was taken by al-Mukhtar ibn Abi
'Ubayd, who was supported by many "mawali",
non-Arab converts to Islam who felt they were treated as
second-class citizens. Al-Mukhtar was killed in 687, but the
Umayyads realized that strict rule was required. The caliph 'Abd
al-Malik (685-705) appointed the fearsome al-Hajjaj
ibn Yusuf as his governor in Iraq and all of the east.
Al-Hajjaj became a legend as a stern but just ruler. His firm
measures aroused the opposition of the local Arab elite, and in
701 there was a massive rebellion led by Muhammad ibn
al-Ash'ath. The insurrection was defeated only with the
aid of Syrian soldiers. Iraq was now very much a conquered
province, and al-Hajjaj established a new city at Wasit,
halfway between Al-Kufah and Basra, to be a base for a permanent
Syrian garrison. In a more positive way, he encouraged Iraqis to
join the expeditions led by Qutaybah ibn Muslim
that between 705 and 715 conquered what is now Central Asia for
Islam. Even after al-Hajjaj's death in 714, the Umayyad-Syrian
grip on Iraq remained firm, and resentment was widespread.