In 1091 Niẓām al-Mulk, chief minister of the Seljuq sultans who then held power in Baghdad, gave the chair of his college there, the Niẓāmiyya, to a jurist from Ṭūs in Khorasan. Abū Ḥāmid al-Ghazālī had trained at Nishapur under al-Juwaynī, the leading theologian of the Ashʿarite school, and the post placed him at the centre of Sunni learning. Sunni doctrine then faced two challenges at once. The Ismāʿīlī Shiites, who backed a rival caliph in Cairo, taught that truth could come only from an infallible imam. The falāsifa, philosophers in the line of Aristotle and above all of Avicenna, claimed to prove by strict demonstration that the world had no beginning and that God knows things only in general. Al-Ghazālī answered both. He is remembered for two moves that seem to pull apart: he turned the philosophers' own logic against their proofs, then concluded that the certainty he wanted could not be reached by proof at all.
The first move is The Incoherence of the Philosophers, composed in Baghdad around 1095. Its charge is that the philosophers had not shown what they said they had shown. Of the twenty positions it examines, al-Ghazālī judged three to be unbelief — that the world has always existed, that God does not know particular things, and that the body is not raised at the resurrection — and at the end of the book, writing as a jurist, he ruled that anyone who taught them in public was an apostate who could be put to death. The book's most famous discussion is of cause and effect. When fire touches cotton, the cotton burns, but nothing we observe shows that the fire makes it burn; God creates the burning, and what we call nature is the order God usually keeps.
In Deliverance from Error, his account of his own development, al-Ghazālī says he read the philosophers on his own for two years and wrote his refutation in a third. Modern scholars read this as a defence against critics: in their view he met these ideas much earlier, under al-Juwaynī, whose works already show Avicenna's influence. He kept what he could use. In Miʿyār al-ʿilm, "The Standard of Knowledge", he taught Aristotle's logic to theologians as a tool, and through him that logic entered the religious sciences for good.
The second move came in the same years. By his own account, he had once doubted the senses and even reason, and certainty returned to him not as the end of an argument but as a light that God cast into his breast. He then tested the theologians, the philosophers, the Ismāʿīlīs and the Sufis (the Muslim mystics) and found that only the Sufis had what he lacked: knowledge gained by practice and direct experience. He came to judge, he writes, that his teaching served his reputation rather than God. In 1095, after some six months of indecision, his tongue failed at the lectern and his doctors told him the illness was in the heart. He announced a pilgrimage to Mecca, went instead to Damascus, and lived there in seclusion, by his own report spending his days in a minaret of the great mosque with the door shut. In 1096, at the tomb of Abraham in Hebron, he vowed never again to serve a ruler or teach at a college paid for by the state.
The book of those years is the Iḥyāʾ ʿulūm al-dīn, The Revival of the Religious Sciences: forty books that set the inner life (sincerity, patience, love of God, the remembrance of death) beside the law that governs outward acts. In 1106, at the start of a new Islamic century, he broke his vow and returned to teaching at the Niẓāmiyya of Nishapur. He cited widespread confusion about religion and pressure from the court; a saying of the Prophet promises a renewer of religion at the turn of each century, and he counted himself as one. Critics at Nishapur charged that the Revival was tainted with philosophy, and in al-Andalus, chroniclers report, the Almoravid ruler had copies burned at Córdoba, an event most often dated to 1109. He died at Ṭūs in December 1111.
Latin Europe knew him as "Algazel" through a single book, Maqāṣid al-falāsifa, "The Aims of the Philosophers", his summary of Avicenna's teaching. The translators at Toledo left out the lines in which he said he was only reporting, so Algazel passed for a faithful follower of Avicenna, and the book became a main source on the Arabic philosophers for Thomas Aquinas and his teacher Albert the Great. Averroes, the Andalusian philosopher, answered the Incoherence point by point in The Incoherence of the Incoherence, and many Western readers accepted the reply's verdict that the original was not philosophy. Whether his attack ended serious philosophy in the Islamic world is still argued; historians of Islamic philosophy point to the philosophers who wrote after him. Among Muslim theologians his rule for a conflict between reason and the literal word of scripture, that where a proof is truly demonstrative the word must be read figuratively, was accepted almost everywhere, and he is still called Ḥujjat al-Islām, the Proof of Islam.