In 1097, after the surrender of Nicaea to the Byzantines, Alexios named John as commander-in-chief of the Byzantine army in Anatolia, and tasked with recovering the Aegean littoral from the Turks. To avoid conflict and facilitate negotiations, he was given custody of the wife of the Seljuk sultan of Rûm Kilij Arslan I () and the daughter of Tzachas, who had been captured at Nicaea. John gave command of the fleet to Kaspax, and marched against Smyrna. After a short siege, Tzachas agreed to surrender the city in exchange for his safe departure and guarantees of the inhabitants' safety. The "megas doux" readily accepted and took possession of the city, naming Kaspax as its governor. Even before Kaspax could assume his duties however, he was murdered by a Muslim, and the enraged sailors of the fleet massacred the people of the city. John Doukas was unable to restrain them, and restored order only after the massacre had run its course. He then left the experienced general Hyaleas behind as "doux" of the city along with the entire fleet to secure the city, and continued his campaign. From Smyrna, John marched south to Ephesus. There, he defeated the Turkish garrison after a long battle, and took 2,000 captives, who were resettled in the Aegean islands. Petzeas was installed as "doux" of Ephesus, and John with his army turned inland. He took the cities of Sardeis and Philadelphia, which he entrusted to Michael Kekaumenos, and reached Laodicea, which opened its gates to him. From there, he marched to the fortresses of Choma and Lampe, installing Eustathios Kamytzes as governor, and reached Polybotos, where most of the Turks who had survived at Ephesus had fled. Having caught them by surprise, Doukas's army defeated them and took much booty.