In 711, a Muslim expedition defeated Raja Dahir at what is now Hyderabad in Sindh and established Umayyad rule by 712. The Umayyad brought under control the whole of what is modern Pakistan, from Karachi to Kashmir and reached the borders of Kashmir within three years. But rather soon afterwards semi-independent Arab ruled states developed.