The Shafi'i (Arabic: شافعي Shāfiʿī ) madhhab is one of the four schools of Islamic law in Sunni Islam. It was founded by the Arab scholar Al-Shafi‘i, a pupil of Malik, in the early 9th century. The other three schools of Sunni jurisprudence are Hanafi, Maliki and Hanbali.
The Shafi school predominantly relies on the Quran and the Hadiths for Sharia. Where passages of Quran and Hadiths are ambiguous, the school first seeks religious law guidance from Ijma – the consensus of Sahabah (Muhammad's companions). If there was no consensus, the Shafi'i school relies on individual opinion (Ijtihad) of the companions of Muhammad, followed by analogy.
The Shafi'i school was, in the early history of Islam, the most followed ideology for Sharia. However, with the Ottoman Empire's expansion and patronage, it was replaced with the Hanafi school in many parts of the Muslim world. One of the many differences between the Shafi'i and Hanafi schools is that the Shafi'i school does not consider Istihsan (the personal preference of Islamic legal scholars) as an acceptable source of religious law because it amounts to "human legislation" of Islamic law.
The Shafi'i school is now predominantly found in Somalia, Eritrea, Ethiopia, Djibouti, eastern Egypt, the Swahili coast, Yemen, Kurdish regions of the Middle East, Dagestan, Chechen and Ingush regions of the Caucasus, Palestine, Lebanon, Indonesia, Malaysia, Maldives, some coastal parts of Sri Lanka, India, Singapore, Myanmar, Thailand, Brunei, and the Philippines.