Ahmad Sanjar invading from Khorasan took his army into Afghanistan and inflicted a crushing defeat to Arslan near Ghazni at Shahrabad. Arslan managed to escape and Bahram succeeded to the throne as the Seljuk's vassal.[2]