The understanding of the laws and code of conduct of Islam is something that has constantly been evolving throughout Islamic history. The first generations of Muslims after the Prophet ﷺ had a much easier time understanding what is expected out of them as Muslims because they had access to the Sahaba, the companions of the Prophet ﷺ. As history progressed, however, a need arose to codify Islamic laws into organized and easy to access law codes.
The first person who undertook this monumental task was the great scholar Imam Abu Hanifa. Through his efforts, the first school of fiqh (Islamic jurisprudence), the Hanafi school, developed. Today, the Hanafischool is the largest and most influential among the four schools (madhabs) of fiqh.

Early Life and Education
Abu Hanifa's given name was Nu'man ibn Thabit. He was born in 699 in the Iraqi city of Kufa, to a family of Persian origin. His father, Thabit, was a successful businessman in Kufa and thus the young Abu Hanifa intended to follow in his father's footsteps. Living under the oppressive reign of the governor of Iraq, al-Hajjaj ibn Yusuf, Abu Hanifa stayed focused on running the family silk-making business and generally steered clear of scholarship. With the death of al-Hajjaj in 713 came the removal of oppressive policies regarding scholars, and Islamic scholarship soared in Kufa, especially during the reign of Umar ibn Abd al-Aziz (717-720).

Thus, by his teenage years, Abu Hanifa began to study under some of the resident scholars of Kufa. He even got the opportunity to meet between eight and ten companions of Prophet Muhammad ﷺ, among them Anas ibn Malik, Sahl ibn Sa'd, and Jabir ibn Abdullah. After learning from some of the greatest scholars of Kufa, he went on to study in Makkah and Madinah under numerous teachers, namely Ata ibn Abu Rabah, who was known as one of the greatest scholars of Makkah at the time.

He soon became an expert in the sciences of fiqh (jurisprudence), tafsir (exegesis of the Quran), and kalam (seeking theological knowledge through debate and reason). In fact, the concept of using debate and logic became a cornerstone of his methodology for seeking Islamic laws.

His School of Fiqh

The Imam Abu Hanifa Mosque in Baghdad

Imam Abu Hanifa was a firm believer that a code of laws cannot stay static for too long, at the risk of no longer meeting the needs of the people. Thus he advocated interpreting the sources of Islamic law (usulal-fiqh) in response to the needs of the people at the time. This dynamic form of legalism did not supersede the Quran and Sunnah (sayings and doings of the Prophet ﷺ), of course. Instead, he promoted the use of the Quran and Sunnah to derive laws that addressed the issues that people dealt with at that time.

A major aspect of his methodology was the use of debate to derive rulings. He would commonly pose a legal issue to a group of about 40 of his students, and challenge them to come up with a ruling based on the Quran and Sunnah. Students would at first attempt to find the solution in the Quran, if it was not clearly answered in the Quran, they would turn to the Sunnah, and if it was not there, they would use reason to find a logical solution.

Abu Hanifa based this methodology on the example when Prophet Muhammad ﷺ sent Mu'adh ibn Jabal to Yemen and asked him how he will resolve issues using Islamic law. Mu'adh responded that he would look into the Quran, then the Sunnah, and if he does not find a direct solution there, he would use his best judgement, an answer that Muhammad ﷺ was pleased with.

Using such a process for codifying fiqh, the Hanafimadhab (school of law) was thus founded, based on the rulings of Imam Abu Hanifa, and his prominent students, Abu Yusuf, Muhammad al-Shaybani, and Zuffar.

His Legacy

A map of the distribution of madhab's worldwide today. The Hanafimadhab is in light green.

Numerous times throughout his later life, Abu Hanifa was offered a position as a chief judge in the city of Kufa. He consistently refused such appointments and thus found himself regularly imprisoned by both the Umayyad and later, the Abbasid authorities. He died in the year 767 while in prison.

A masjid was built in his honor in Baghdad years later, and was renovated in the Ottoman period by the monumental architect Mimar Sinan.

His school of law became very popular in the Muslim world not long after his death. As the official madhab of the Abbasid, Mughal, and Ottoman Empires, his school became very influential throughout the Muslim world. Today, it is very popular in Turkey, Syria, Iraq, the Balkans, Egypt, and the Indian Subcontinent.

711- Imam Malik – The Scholar of Madinah
The collection and codification of Islamic law has historically been one of the most important, and challenging, tasks that the Muslim community has undertaken in 1400 years of history. To be considered a faqih (an expert in Islamic law – fiqh), one must have mastery of the Quran, the sayings of Prophet Muhammad ﷺ, other sources of law, as well as other subjects such as grammar and history.

One of the giants of Islamic law was the 8th century scholar of Madinah, Malik ibn Anas. At a time when the Muslim community desperately needed the sciences of fiqh and hadith (sayings and doings of Prophet Muhammad ﷺ) to be organized, Imam Malik rose to the occasion. His legacy is manifest in his continued influence throughout the Muslim world, both through his own works and the works of those he helped guide on a path of scholarship and devotion to Islam.

Early Life and Education
Imam Malik was born in 711 in the city of Madinah, 79 years after the death of Prophet Muhammad ﷺ in that same city. His family was originally from Yemen, but his grandfather had moved to Madinah during the reign of Umar ibn al-Khattab. Both his father and grandfather had studied religious sciences under the Companions of the Prophet who still lived in Madinah, and thus young Malik was raised in an environment that was based on Islamic scholarship, learning from his father and uncle.

Imam Malik's uncle, Nafi', was an eminent scholar in his own right, and narrated hadith from Aisha, Abu Hurairah, and Abdullah ibn Umar, all companions who are noted for their vast knowledge of hadith. Although the political center of the Muslim world shifted away from Madinah during the caliphate of Ali in the 650s, it remained the intellectual capital of Islam. In this capital of Islamic knowledge, Imam Malik mastered the sciences of hadith, tafsir (interpretation of the Quran), and fiqh.

The Scholar of Madinah
After an immense amount of study that extended into his 20s and 30s, Imam Malik became known as the most learned man in Madinah at his time. He became a teacher, attracting a huge number of students to lectures, which he held in the mosque of the Prophet ﷺ. He used to sit on the pulpit of the mosque with the Quran in one hand and a collection of hadith in the other and offer legal rulings and opinions based on those two sources.

Students flocked to his lectures from all corners of the Muslim world. Among his more notable students were Abu Yusuf, Muhammad al-Shaybani (they were Abu Hanifah's two most important students as well), and Imam al-Shafi'i.

Imam Malik held his classes in the Masjid al-Nabawi in Madinah

The most unique aspect of Imam Malik's methodology in fiqh was his reliance on the practices of the people of Madinah as a source of law. In the study of fiqh, there are numerous sources that are used to derive laws. The first and second most important sources are always the Quran and Sunnah. After those two, however, the great scholars of fiqh differed on the next most important source of law. Imam Malik believed that the practices of the people of Madinah should be seen as an important source.

His reasoning for this was that Madinah at that time was not far removed from the Madinah of Prophet Muhammad ﷺ. It had been spared the political and social upheaval that much of the rest of the Muslim world dealt with. And the people living in the city had been taught Islam by their ancestors who had been Companions of the Prophet ﷺ or students of the Companions. He thus reasoned that if all of the people of Madinah practiced a particular action and it did not contradict the Quran and Sunnah, then it can be taken as a source of law. He is unique among the four great imams of fiqh in this opinion.

In order to ease the study of fiqh and hadith, Imam Malik compiled a book known as the al-Muwatta. This was the first book that attempted to compile only sound and reliable sayings of Prophet Muhammad ﷺ into one book. Imam Malik said that he showed his book to seventy scholars in Madinah, who all approved it, thus he gave it the name al-Muwatta, meaning "The Approved".

Al-Muwatta was a landmark book. It helped establish the science of hadith, particularly the judging of chains of narrations for hadith. Imam Malik was so thorough in his selection of hadith that it has been placed on the same level (and sometimes above) the hadith compilations of Imams Bukhari and Muslim. Imam Shafi'i even stated that there is no book on earth, after the Quran, that is more authentic than the Muwatta.

Imam Malik's work was so influential as a book of fiqh that the caliph of the time, Harun al-Rashid, demanded that it be mass-printed and made the official book of fiqh for the Abbasid Empire. Imam Malik, however, refused. He knew that no one interpretation of Islamic law was perfect and all-encompassing. As such, he refused to allow his fiqh to become official, even under threat of persecution and imprisonment.

Imam Malik's Character
Besides being one of the greatest scholars of fiqh in history, Imam Malik was an incredibly humble and meticulous Muslim. Out of respect for the Prophet ﷺ and his words, he would refuse to narrate a hadith while walking. Instead, when asked about a hadith, he would stop, sit down, and give the hadith the attention it deserved, out of respect for Prophet Muhammad ﷺ. He would also refuse to ride any animal in the city of Madinah, seeing it as unfathomable that he would ride on the same dust that Muhammad ﷺ's feet walked on. This type of extra respect and meticulousness out of respect for Prophet Muhammad ﷺ certainly is not mandatory according to Islamic law, but simply a sign of the emphasis Imam Malik placed on the importance of Muhammad ﷺ.

Imam Malik's seminal work, al-Muwatta

Among Imam Malik's sayings are:
"The Sunnah is the ark of Nuh. Whoever boards it is saved, and whoever remains away perishes."

"Knowledge does not consist in narrating much. Knowledge is but a light which Allah places in the heart."

"None renounces the world and guards himself without then ending up speaking wisdom."
When Imam Malik embarked on the study of Islamic sciences with a teacher, his mother advised him to "learn from your teacher his manners before you learn from him his knowledge."

Imam Malik's ideology on fiqh developed into the Maliki madhab (school). As Imam Malik wished, it was not imposed on Muslims as the sole school of Islamic law. Instead, it complemented the other three schools that took precedence in the Sunni Muslim world – the Hanafi, Shafi'i, and Hanbali schools. The Maliki school became very popular in North and West Africa, as well as Muslim Spain. Today it remains the main madhab of North and West Africa.

767 Imam al-Shafi'i – the Father of Usul al-Fiqh
In the study of fiqh, Islamic jurisprudence, different schools have developed over time. These schools were founded by the greatest legal minds in Islamic history, and expanded upon by their successors in their schools. Each one of these imams added a unique and new dimension to the understanding of Islamic law.

For the third of the four great imams, Imam Muhammad al-Shafi'i, his great contribution was the codifying and organization of a concept known as usul al-fiqh - the principles behind the study of fiqh. During his illustrious career, he learned under some of the greatest scholars of his time, and expanded on their ideas, while still holding close to the Quran and Sunnah as the main sources of Islamic laws. Today, his madhab (school of thought), is the second most popular on earth, after the madhab of Imam Abu Hanifa.

Early Life
Muhammad ibn Idris al-Shafi'i was born in 767 (the year of Imam Abu Hanifa's death) in Gaza, Palestine. His father died when he was very young, and thus his mother decided to move to Makkah, where many members of her family (who were originally from Yemen) were settled. Despite being in a very bad economic situation, his mother insisted that he embark on a path towards scholarship, especially considering the fact that he was from the family of the Prophet Muhammad ﷺ.

Thus, as a young man, he was trained in Arabic grammar, literature, and history. Because of his family's financial situation, his mother could not afford proper writing materials for the young al-Shafi'i. He was thus forced to take notes in his classes on old animal bones. Despite this, he managed to memorize the Quran at the age of seven. Afterwards, he began to immerse himself in the study of fiqh, and memorized the most popular book of fiqh at the time, Imam Malik's Muwatta, which he memorized by age ten.

Studies Under Imam Malik
At the age of thirteen, he was urged by the governor of Makkah to travel to Madinah and study under Imam Malik himself. Imam Malik was very impressed with the intelligence and analytical mind of the young al-Shafi'i, and provided him with financial assistance to ensure that he remains in the study of fiqh.

In Madinah, al-Shafi'i was completely immersed in the academic environment of the time. In addition to Imam Malik, he studied under Imam Muhammad al-Shaybani, one of Imam Abu Hanifa's foremost students. This familiarized al-Shafi'i with differing viewpoints on the study of fiqh, and he greatly benefited from the exposure to various approaches to fiqh. When Imam Malik died in 795, Imam Shafi'i was known to be one of the world's most knowledgeable scholars, even though he was in his 20s.

His Travels
Not long after Malik's death, Imam Shafi'i was invited to Yemen to work as a judge for the Abbasid governor. His stay there would not last long however. The problem was that as an academic, Imam Shafi'i was not ready for the politically-charged environment he found himself in. Because he insisted on being uncompromisingly fair and honest, numerous factions within the government made it their aim to remove him from his post.

A map of the distribution of madhab's worldwide today. The Shafi'imadhab is in blue.

In 803, he was arrested and carried in chains to Baghdad, the seat of the Abbasid Caliphate, on trumped-up charges of supporting Shia rebels in Yemen. When he met with the caliph of the time, Harun al-Rashid, Imam Shafi'i gave an impassioned and eloquent defense, which greatly impressed the caliph. Imam Shafi'i was not just released, but Harun al-Rashid even insisted that Imam Shafi'i stay in Baghdad and help spread Islamic knowledge in the region. Al-Shafi'i agreed and smartly decided to stay away from politics for the remainder of his life.

While in Iraq, he took the opportunity to learn more about the Hanafimadhab. He was reunited with his old teacher, Muhammad al-Shaybani, under whom he mastered the intricate details of the madhab. Although he never met Imam Abu Hanifa, he had great respect for the originator of the study of fiqh, and his school of thought.

Throughout his 30s and 40s, Imam al-Shafi'i traveled throughout Syria and the Arabian Peninsula, giving lectures and compiling a large group of students that studied under him. Among them was Imam Ahmad, the originator of the fourth school of fiqh, the Hanbalimadhab. Eventually, he finally went back to Baghdad, but found out that the new caliph, al-Ma'mun, held some very unorthodox beliefs about Islam, and was known to persecute those who disagreed with him. As a result, in 814, Imam Shafi'i made his final move, this time to Egypt, where he was able to polish off his legal opinions and finally organize the study of usul al-fiqh.

During the 700s and the early part of the 800s, there were two competing philosophies about how Islamic law should be derived. One philosophy was promoted by ahl al-hadith, meaning "the people of Hadith". They insisted on absolute reliance on the literal interpretation of Hadith and the impermissibility of using reason as a means to derive Islamic law. The other group was known as ahl al-ra'i, meaning "the people of reason". They also believed in using Hadith of course, but they also accepted reason as a major source of law. The Hanafi and Maliki schools of fiqh were mostly considered to have been ahl al-ra'i at this time.

Al-Risala of Imam Shafi'i

Having studied both schools of fiqh, as well as having a vast knowledge of authentic hadith, Imam al-Shafi'i sought to reconcile the two philosophies and introduce a clear methodology for fiqh – known as usul al-fiqh. His efforts towards this end resulted in his seminal work, Al-Risala.
Al-Risala was not meant to be a book that discussed particular legal issues and al-Shafi'i's opinion on them. Nor was it meant to be a book of rules and Islamic law. Instead, it was meant to provide a reasonable and rational way to derive Islamic law. In it, Imam al-Shafi'i outlines four main sources from which Islamic law can be derived:
1. The Quran
2. The Sunnah of Prophet Muhammad
3. Consensus among the Muslim community
4. Analogical deduction, known as Qiyas
For each one of these sources (as well a several more sources that he deems not as important), he goes in depth in his Risala, explaining how they are to be interpreted and reconciled with each other. The framework he provides for Islamic law became the main philosophy of fiqh that was accepted by all subsequent scholars of Islamic law. Even the Hanafi and Maliki schools were adapted to work within the framework that al-Shafi'i provided.

The contributions of Imam al-Shafi'i in the field of usul al-fiqh were monumental. His ideas prevented the fraying of the study of fiqh into hundreds of different, competing schools by providing a general philosophy that should be adhered to. But it also provided enough flexibility for there to still be different interpretations, and thus madhabs. Although he probably did not intend it, his followers codified his legal opinions (which were laid out in another book, Kitab al-Umm) after his death in 820, into the Shafi'imadhab. Today, the Shafi'imadhab is the second largest madhab after the Hanafimadhab, and is very popular in Egypt, Palestine, Syria, Yemen, East Africa, and Southeast Asia.

Language of Imam Shafi'i
Besides being a giant of a scholar in the field of fiqh, Imam Shafi'i was noted for his eloquence and his knowledge of the Arabic language. During his travels, Bedouins, who were known to be the best-versed in the Arabic language, would attend his lectures not to gain knowledge of fiqh, but just to marvel as his use of language and his mastery of poetry. One of his companions, Ibn Hisham, noted that "I never heard him [Imam Shafi'i] use anything other than a word which, carefully considered, one would not find a better word in the entire Arabic language."

778-855 Imam Ahmad ibn Hanbal – The Champion of Islamic Belief
So far in our four part series on the four great imams of fiqh (Islamic jurisprudence), we have seen each one of the imams have a special and enduring role in Islamic history. Imam Abu Hanifa was the trailblazer when it came to codifying fiqh and establishing the basics of how it is to be studied. Imam Malik upheld the importance of hadith in the field of fiqh through his landmark collection of hadith, al-Muwatta. And Imam al-Shafi'i revolutionized the study of fiqh by establishing the field of usul al-fiqh, the principles behind the study of fiqh.

For the last of the four great imams, Ahmad ibn Hanbal, his contribution went beyond just fiqh. Although he was one of the greatest jurists and scholars of hadith of his time, perhaps his greatest legacy was his courage to stand for the orthodox beliefs of Islam as they were imparted to Prophet Muhammad ﷺ in the face of persecution and imprisonment at the hands of the political authority. For this reason, Imam Ahmad's legacy is far more than just the establishment of the Hanbalimadhab, but also includes the preservation of core Islamic beliefs against political oppression.

Early Life
Ahmad ibn Hanbal al-Shaybani was born in 778 in Baghdad, the capital of the Abbasid Caliphate. The relatively new city was fast becoming a center of scholarship of all forms. So as a child, Ahmad had numerous opportunities to learn and expand his intellectual horizons. Thus, by the time he was 10 years old, he had memorized the entire Quran and began studying the traditions of Prophet Muhammad ﷺ, the hadith.

Imam Ahmad traveled throughout the Arabian Peninsula in search of knowledge

Like Imam Shafi'i, Imam Ahmad lost his father at a very young age. So in addition to spending his time studying fiqh and hadith under some of Baghdad's greatest scholars, he also worked in a post office to help support his family. He was thus able to afford studying under one of Imam Abu Hanifa's foremost students, Abu Yusuf. From Abu Yusuf, the young Ahmad learned the basics of fiqh such asijtihad (intellectual decision making), andqiyas (analogical deduction).

After becoming proficient in the HanafiMadhab, Ahmad ibn Hanbal began to study Hadith under some of the greatest Hadith scholars of Baghdad, including Haitham ibn Bishr. He was so eager to expand his knowledge of the sayings and doings of the Prophet ﷺ that he would regularly be waiting after fajr outside of the homes of his teachers, ready to start that day's lesson.

After studying in Baghdad, he went on to study in Makkah, Madinah, Yemen, and Syria. During this time, he even met Imam al-Shafi'i in Makkah. Al-Shafi'i helped the young Ahmad move beyond just memorization of hadith and fiqh, and be able to instead also understand the principles behind them. This collaboration between two of the four great imams clearly shows that the schools of Islamic law are not opposed to each other, but rather work hand in hand.

In fact, when Imam al-Shafi'i left Baghdad, he was recorded as having said, "I am leaving Baghdad when there is none more pious, nor a greater jurist than Ahmad ibn Hanbal."
Ahmad ibn Hanbal the Scholar

After studying with Imam al-Shafi'i, Imam Ahmad was able to begin to formulate his own legal opinions in fiqh. When Imam Ahmad was 40 years of age in the year 820, his mentor Imam al-Shafi'i passed away. At this point, Imam Ahmad began to teach hadith and fiqh to the people of Baghdad. Students would flock to his lectures, and he especially took care of the poorer ones, keeping in mind his own humble origins.

Despite being in the capital of the Muslim world, Baghdad, Imam Ahmad refused to be attracted to a life of luxury and wealth. He continued to live on very humble means, and rejected the numerous gifts that people would offer him, instead choosing to live on whatever small amounts of money he had. He especially insisted on not accepting gifts from political figures, ensuring his independence from the political authority which could affect his teachings.

The Mihna
Imam Ahmad was in Baghdad during the time of the Abbasid Caliph al-Ma'mun, who reigned from 813-833. Although al-Ma'mun was vital to the establishment of Baghdad as an intellectual center, he was heavily influenced by a group known as the Mu'tazila. Mu'tazili philosophy championed the role of rationalism in all aspects of life, including theology. Thus, instead of relying on the Quran and Sunnah to understand God, they relied on philosophical techniques first developed by the Ancient Greeks. Chief among their beliefs was that the Quran was a created book, as opposed to the un-created literal word of Allah.

Al-Ma'mun believed in the Mu'tazili line of thought, and sought to impose this new and dangerous belief system on everyone in his empire – including the scholars. While many scholars pretended to subscribe to Mu'tazili ideas in order to avoid persecution, Imam Ahmad refused to compromise his beliefs.

Legal writings based on the HanbaliMadhab written by Abu Dawud in the late 800s.

Al-Ma'mun instituted an inquisition known as the Mihna. Any scholars who refused to accept Mu'tazili ideas was severely persecuted and punished. Imam Ahmad, as the most famous scholar of Baghdad, was brought before al-Ma'mun and ordered to abandon his traditional Islamic beliefs about theology. When he refused, he was tortured and imprisoned. His treatment at the hands of the political authority was extremely severe. People who witnessed the torture commented that even an elephant could not have handled the treatment that Imam Ahmad was subject to.

Despite all of this, Imam Ahmad held to traditional Islamic beliefs, and thus served as an inspiration for Muslims throughout the empire. His trials set the precedent that Muslims do not give up their beliefs regardless what the political authority imposes on them. In the end, Imam Ahmad outlived al-Ma'mun and his successors until the Caliph al-Mutawakkil ascended in 847 and ended the Mihna. Imam Ahmad was again free to teach the people of Baghdad and write. During this time, he wrote his famous Musnad Ahmad ibn Hanbal, a collection of hadith that served as the basis of his school of legal thought, the HanbaliMadhab.

Imam Ahmad passed away in Baghdad in 855. His legacy was not restricted to the school of fiqh that he founded, nor the huge amount of hadith he compiled. Unlike the other three imams, he had a vital role in preserving the sanctity of Islamic beliefs in the face of intense political persecution. Although the HanbaliMadhab has historically been the smallest of the four, numerous great Muslim scholars throughout history were greatly influenced by Imam Ahmad and his thoughts, including Abdul Qadir al-Gilani, Ibn Taymiyyah, Ibn al-Qayyim, Ibn Kathir, and Muhammad ibn Abd al-Wahhab.