The situation worsened further for Ali Mardan, when Karim Khan returned to Isfahan in January 1751 and restored order in the city. A battle shortly occurred between them in Luristan—during the battle, Ismail III and Zakariya Khan (who was now his "vizier"), together with several prominent officers, deserted Ali Mardan and joined Karim Khan, who eventually emerged victorious, forcing Ali Mardan and the remains of his men, together with the governor of Luristan, Ismail Khan Feyli, to retreat to Khuzestan. There Ali Mardan made an alliance with Shaykh Sa'd, the governor of Khuzestan, who reinforced him with soldiers. In the late spring of 1752, Ali Mardan, together with Ismail Khan Feyli, marched to Kermanshah. The forces of Karim Khan shortly attacked their encampment, but were repelled. Ali Mardan then went further into domains of the Zands, which resulted in a battle with Karim Khan near Nahavand. Ali Mardan, however, was once again defeated, and forced to withdraw into the mountains, where he went to the Ottoman city of Baghdad.