In 1838 Moltke was sent as an adviser to the Ottoman general commanding the troops in Anatolia, who was to carry on a campaign against Muhammad Ali of Egypt. During the summer Moltke made extensive reconnaissances and surveys, riding several thousand miles in the course of his journey. He navigated the rapids of the Euphrates and visited and mapped many parts of the Ottoman Empire. In 1839 the army moved south to fight the Egyptians, but upon the approach of the enemy, the general refused to listen to Moltke's advice. Moltke resigned his post of staff officer and took charge of the artillery. In the Battle of Nezib (modern-day Nisibis) on 24 June 1839, the Ottoman army was beaten. With great difficulty, Moltke made his way back to the Black Sea, and thence to Constantinople. His patron, Sultan Mahmud II, was dead, so he returned to Berlin where he arrived, broken in health, in December 1839.