Al-Ghazali held the most prestigious teaching post in the Islamic world, at the Nizamiyya in Baghdad, and abandoned it at the age of thirty-seven. He describes the crisis in Deliverance from Error: a collapse of confidence so complete that he could not lecture, followed by eleven years of withdrawal, travel and Sufi practice, and eventually a return to teaching on a different basis. The autobiography is one of the first works of its kind, and its account of doubt — testing sense, then reason, and finding no criterion that certifies either without circularity — is close enough to Descartes's that the parallel has been argued over for centuries, though no line of transmission has ever been established.
His most consequential book is The Incoherence of the Philosophers, an attack on the system al-Farabi and Avicenna had built. The argument is not that philosophy is forbidden but that it overreaches: on twenty specific questions the philosophers claim demonstrative proof and have none. Three of their conclusions he judges outright incompatible with Islam — the eternity of the world, God's knowledge of particulars only in a general way, and the denial of bodily resurrection. The section that mattered most to later European thought is his treatment of causation. What we call a cause and an effect are two things habitually observed together; the connection between them is not logical, since either is conceivable without the other, and the regularity is the direct act of God rather than a power in the fire to burn. The structure of that argument reappears in Hume, again without a demonstrable route.
Averroes replied with The Incoherence of the Incoherence, and the exchange became the classic confrontation between philosophy and theology in Islam. Both texts were known in the Latin west, where Aquinas engaged the same questions with the same materials.
Al-Ghazali's other achievement is the Revival of the Religious Sciences, a forty-book reconstruction of Islamic practice which made Sufi interiority respectable to the jurists and legalist orthodoxy liveable for the mystics. It is probably the most widely read Islamic book after the Qur'an. The old European claim that he single-handedly closed the door on Islamic philosophy is no longer credible — philosophy continued, particularly in Persia — but the terms on which it continued were the ones he set.
