At the height of his fame as a jurist and theologian in Baghdad, Ghazali underwent a personal and intellectual crisis around 1095: seized by doubt about the foundations of certain knowledge and by the conviction that his learning had become worldly ambition, he abandoned his prestigious teaching post, left the city, and spent years in withdrawal and Sufi practice.
Out of this came his masterwork, the Ihya ulum al-din ("The Revival of the Religious Sciences"), a vast synthesis that sought to breathe inner, spiritual life back into the outward observances of Islamic law, reconciling the jurist's and the theologian's learning with the heart-knowledge of the mystics, and giving Sufism a securely orthodox place at the centre of Sunni piety. His autobiography, al-Munqidh min al-dalal ("Deliverance from Error"), narrates the whole journey through the claims of theology, philosophy, Ismaili authority and Sufism.
A later and much-repeated thesis, that Ghazali's critique dealt a lasting blow to science and philosophy in the Muslim world, is contested among historians, who note that philosophical and scientific work continued vigorously after him; the claim should be treated as a debated interpretation rather than a settled fact.