The Sasanian Persians led by King Khosrow I pillaged and burned Aleppo in 540, then they invaded and controlled Syria briefly in the early 7th century. Soon after Aleppo fell to Muslims under Abu Ubaidah ibn al-Jarrah in 637. In 944, it became the seat of an independent Emirate under the Hamdanid prince Sayf al-Dawla, and enjoyed a period of great prosperity, being home to the great poet al-Mutanabbi and the philosopher and polymath al-Farabi. In 962, the city was sacked by the Byzantine general Nicophorus Phocas. Subsequently, the city and its Emirate became a temporary vassal of the Byzantine Empire. For the next few decades the city was disputed by the Fatimid Caliphate and Byzantine Empire, with the nominally independent Hamdanids in between, eventually falling to the Fatimids in 1017. In 1024, Salih ibn Mirdas launched an attack on the Fatimid Aleppo, and after a few months was invited into the city by its population.