The Battle of Baghdad (946 AD) was fought between the forces of the Buyid Emirate of Iraq under Mu'izz al-Dawla and the Hamdanid Emirate of Mosul under Nasir al-Dawla within the city of Baghdad. The battle lasted for several months; it eventually ended in victory for the Buyids, who expelled the Hamdanids from Baghdad with a major offensive and secured control of the city. The battle was the first conflict in the ; it was also the only one to occur largely on Buyid, rather than Hamdanid, territory.