In 1394, the Ottoman sultan Bayezid I besieged Constantinople. Manuel left the city in 1399 to travel around Western Europe in search for military aid, and entrusted John VII with serving as regent in Constantinople, overseeing its defense. Despite allegations of conspiring with the Ottomans, John VII held the city loyally for the entire duration of Manuel's three and a half years-long journey, refusing to surrender it to Bayezid. The threat to Constantinople ended with Bayezid's defeat against the Timurids at the Battle of Ankara in 1402. In the aftermath of this battle, John VII negotiated a favourable treaty with one of Bayezid's sons, Süleyman Çelebi, which ensured that the important city of Thessalonica, lost to the Ottomans in 1387 due to the actions of Manuel, was returned to imperial control. Despite John VII's loyal service, Manuel sent him away in disgrace once he returned in 1403, and the two were once more enemies. This feud proved to be brief, as they were reconciled a few months later and a new agreement was made, in which John VII was allowed to take possession of Thessalonica and was acknowledged with the full imperial title. From 1403 until his death in 1408, John VII thus ruled in Thessalonica as "Emperor of All Thessaly", with his own separate imperial court. The Thessalonians considered him an able ruler, and his work with local church affairs and improving the city's defensive structures garnered him a positive remembrance.