Miran Shah
After the defeat of Qara Yusuf in the Battle of Algami Canal in 1402, he escaped to Egypt where he was imprisoned till the death of Timur in 1405. When Timur died in 1405 the Mamluk Sultan Nasir-ad-Din Faraj had released Sultan Ahmed Jalayir and Qara Yusuf. Both while in prison, had agreed that if ever they get out alive, Ahmed would keep Iraq while Qara Yusuf would have Azerbaijan. During this time Azerbaijan was under Umar Mirza bin Miran Shah and Baghdad was under the administration of Abu Bakr bin Miran Shah, the two sons of Miran Shah. The two brothers were rivals and their rivalry allowed for the return of Sultan Ahmed Jalayir who took Baghdad after instigating an uprising from his headquarters at Hillah in late 1405.