In February 1916 he was selected for secondment to the now allied Ottoman Army and assigned to Baghdad, as chief of staff to Feldmarschall von der Goltz. There he became chief of staff of the Ottoman Sixth Army, with the Ottoman rank of Mirliva and the accompanying title of Pasha. He participated in the successful siege of Kut-al-Mara and subsequent events in Mesopotamia up to late summer 1916. Infected by unclean drinking water, he suffered severe illness and was transported to Aleppo to recuperate. Gleich subsequently wrote a detailed memoir of his military experiences during 1912-16, which was published in 1921 as "Vom Balkan nach Bagdad: militärisch-politische Erinnerungen an dem Orient" ("From the Balkans to Baghdad: military-political recollections of the East").