Ijmāʿ (Arabic: إجماع) is an Arabic term referring to the consensus or agreement of Islamic scholars on a point of Islamic law.:472 Various schools of thought within Islamic jurisprudence may define this consensus to be that of the first generation of Muslims only; or the consensus of the first three generations of Muslims; or the consensus of the jurists and scholars of the Muslim world, or scholarly consensus; or the consensus of all the Muslim world, both scholars and laymen. Sunni Muslims regard ijmā' as the third fundamental source of Sharia law, after the Qur'an, and the Sunnah. The opposite of ijma (i.e., lack of consensus on a point of Islamic law) is called ikhtilaf.
The hadith of Muhammad which states that "My ummah will never agree upon an error" and similar hadiths are often cited as a proof for the validity of ijmā'. Justification for this doctrine presented a challenge, since these hadiths were transmitted through only a limited number of isnads (transmission chains) and did not qualify as providing certain knowledge under the classical science of hadith criticism. Sunni scholars argued that the nature of human society was such that a community could not mistakenly agree that a statement had been made, and further that the consensus of the ummah about its inability to agree upon an error in itself certified the authenticity of this hadith. Sunni Muslims regard ijmā' as the third fundamental source of Sharia law, just after the divine revelation of the Qur'an, and the prophetic practice known as Sunnah.
There are differing views over who is considered a part of this consensus, whether "the consensus is needed only among the scholars of a particular school, or legists, or legists of an early era, or the Companions, or scholars in general, or the entire Muslim community." 
According to Iraqi academic Majid Khadduri, Al-Shafi'i held the view that religiously binding consensus had to include all of the Muslim community in every part of the world, both the religiously learned and the layman. Thus, if even one individual out of millions would hold a differing view, then consensus would not have been reached. In an attempt to define consensus in a form which was more likely to ever occur, Al-Ghazali expanding on al-Shafi'i's definition to define consensus as including all of the Muslim community in regard to religious principles and restricting the meaning to only the religiously learned in regard to finer details.
Abu Hanifa, Ahmad ibn Hanbal and Dawud al-Zahiri, on the other hand, considered this consensus to only include the companions of Muhammad, excluding all generations which followed them, in Medina and elsewhere.
Views within Sunni Islam branched off even further in later generations, with Abu Bakr Al Jassas, a hanafi scholar, defining even a simple majority view as constituting consensus and Ibn Taymiyyah restricting consensus to the view of the religiously learned only. Muhammad ibn Jarir al-Tabari's position was not entirely clear, as modern scholarship has attributed to him both the view that consensus means a simple majority, and that it means only the consensus of the companions of Muhammad.
According to Ahmad Hasan, the majority view is split between two possibilities: that religiously binding consensus is the consensus of the entire Muslim community, or that religiously binding consensus is just the consensus of the religiously learned. The names of two kinds of consensus are:
Initially, for Shia the authority of the Imams rendered the consensus as irrelevant. With the development of sectarian communities of Imami Shīa Islam, the question of guidance and interpretation between different ulamas became an issue, however the importance of ijmā never reached the level and certainty it had in Sunni Islam. Later, since Safavid and with the establishment of Usuli school at the turn the 19th century the authority of living mujtahid is accepted, however it dies with him. For Shia, the status of ijmā is ambiguous.
The ancient Mu'tazilite sect did not consider consensus to be a valid source of law, primarily due to their rationalist criticism of the first generation of Muslims, whom the Mu'tazila viewed as possessing defective personalities and intellects. Shi'ite theologians Al-Shaykh Al-Mufid and Sharif al-Murtaza held the Mu'tazilite theologian Nazzam's book Kitab al-Nakth, in which his student Al-Jahiz reports that he denied the validity of consensus for this reason, in high esteem. Modern scholarship has suggested that this interest was motivated by the desire of Shi'ite theologians to impugn the character of the first three leaders of the Rashidun Caliphate, Abu Bakr, Umar and Uthman.