Even with the support of Sanjar (who despised Berkyaruq), Muhammad was unable to defeat his rival.[7] In 1101, Muhammad's forces were defeated in a battle near Hamadan, which resulted in the capture of Mu'ayyid al-Mulk, who was taken to Berkyaruq, who had him personally killed.[8]