In 644 A.D. an Arab Army under the command of Hakam defeated the combined forces of Makran and Sindh. The period of Arab rule brought the religion of Islam to the Indus Valley. The Baloch tribes gradually embraced Islam, replacing their centuries-old Zoroastrian religion. Islam arrived in the area of modern Pakistan in 711 AD, 79 yrs after the of death of the prophet Muhammad. The Umayyad dynasty sent a Muslim Arab army led by Muhammad bin Qasim al-Thaqafi against the ruler of Sindh, Raja Dahir. Raja Dahir had given refuge to many Zoroastrian Princes who had fled the Islamic conquest of Iran. Muhammad Bin Qasim's army was defeated in his first three attempts. The Muslim army conquered the northwestern part of Indus Valley from Kashmir to the Arabian Sea.