Muhammad ibn Muhammad ibn Muhammad ibn Ahmad, Abu Hamid al-Tusi al-Ghazzali[or al-Ghazali] al-Shafi`i (450-505), "the Proof of Islam" (Hujja al-Islam), "Ornament of the Faith," "Gatherer of the Multifarious Sciences," "Great Siddîq," absolute mujtahid, a major Shafi'i jurist, heresiographer and debater, expert in the principles of doctrine and those of jurisprudence, and a master of philosophy.
Shaykh Yusuf al-Qaradawi stated that, like 'Umar ibn 'Abd al-'Aziz and al-Shafi'i for their respective times, al-Ghazzali is unanimously considered the Renewer of the Fifth Islamic Century. Ibn al-Subki writes: "He came at a time when people stood in direr need of replies against the philosophers than the darkest night stands in need of the light of the moon and stars."
On his way back from Jurjan to Tus al-Ghazzali was robbed by highwaymen. When they left him he followed them but was told: "Leave us or you will die." He replied: "I ask you for Allah's sake to only return to me my notes, for they are of no use to you." The robber asked him: "What are those notes?" He said: "Books in that satchel, for the sake of which I left my country in order to hear, write, and obtain their knowledge." The robber laughed and said: "How can you claim that you obtained their knowledge when we took it away from you and left you devoid of knowledge!" Then he gave an order and the satchel was returned to him. Al-Ghazzali said: "This man's utterance was divinely inspired (hâdhâ mustantaqun): Allah caused him to say this in order to guide me. When I reached Tus I worked for three years until I had memorized all that I had written down."
Al-Ghazzali came to Baghdad in 484 and began a prestigious career of teaching, giving fatwa, and authoring books in nearly all the Islamic sciences of his day. His skill in refuting opponents was unparalleled except by his superlative godwariness, which led him to abandon his teaching position at the Nizamiyya school four years later, deputizing his brother Ahmad, famous for his preaching, to replace him. Upon completion of pilgrimage to Mecca al-Ghazzali headed for Damascus, then al-Qudus, then Damascus again where he remained for several years, taking up the ascetic life with the words: "We sought after knowledge for other than Allah's sake, but He refused that it be for anything other than Him."
He came out of seclusion in 499 and travelled to Cairo, Iskandariyya and other places, finally returning to Baghdad where he taught his magnum opus Ihya' 'Ulum al-Din until his death in nearby Tus, occupying the remainder of his time with devotions, Qur'an recitations, prayer and fasting, and the company of Sufis. Ibn al-Jawzi narrated in al-Thabat 'Inda al-Mamat ("Firmness at the Time of Death") from al-Ghazzali's brother Ahmad: "On Monday [14 Jumada al-Akhira] at the time of the dawn prayer my brother Abu Hamid made his ablution, prayed, then said: 'Bring me my shroud.' He took it, kissed it and put it on his eyes, saying: 'We hear and obey in readiness to enter the King's presence.' Then he stretched his legs, facing the Qibla, and died before sunrise ( may Allah sanctify his soul! ). It is related that al-Shadhili saw a dream in which the Prophet Muhammed (Sallallahu alaihi wa sallam) pointed out al-Ghazzali to Musa (AS) and 'Isa (AS) asking them: "Is there such a wise scholar in your communities?" to which they replied no.
Ibn al-Subki narrated with his chain from Abu al-Hasan al-Shadhili that Ibn Hirzahm, one of the Moroccan shaykhs who had intended the burning of the book (Ihya), saw the Prophet in his dream commending the book before al-Ghazzali and ordering that Ibn Hirzahm be lashed for slander. After five lashes he was pardoned and woke up in pain, bearing the traces of the lashing. After this he took to praising the book from cover to cover.
NB- the philosophers at the time of Imam Ghazali, like now, were attacking religion and Islamic beliefs. But Imam Ghazali mastered philosophy and memorised at least 10,000 pages in philosophy and then refuted the philosophers by using philosophy to show that philosophy doesn't lead to certainty nor to the unIslamic beliefs. His "tahafut" is a famous work that showed that.
For more on Imam Ghazali and his list of works and fatwas, see the end of: