From 945 to 1055, the Iranian Buyid dynasty ruled Baghdad and most of Iraq. Abu al Qasim al-Baridis, who still controlled Basra and Wasit, were defeated and their lands taken by the Buyids in 947. Adud al-Dawla and his sons Diya' al-Dawla and Samsam al-Dawla were the Buyid rulers of Basra during the 970s, 980s and 990s. Sanad al-Dawla al-Habashi (ca.921–977), the brother of the Emir of Iraq Izz al-Dawla, was governor of Basra and built a library of 15,000 books.