 However, general Ghalib ibn Abd ar-Rahman and Muhammad Ibn Abi Amir formed an alliance, and in 978 they overthrew al-Mushafi and his sons and other family members, who had received offices.Al-Mushafi was imprisoned for five years before being killed, and his family was stripped of property and titles.In 980, Ibn Abi Amir fell out with his ally Ghalib, and a civil war began.