In the name of Allah, the most Beneficent, the most Merciful.
The third principle of Islamic Sharia Law is called Ijma.
Ijma literally means to determine or to agree upon something. Technically, Ijma is defined as the unanimous agreement of the scholars and jurists of the Muslim community of any period following the demise of the Prophet of Allah Sallallahu Alahi Wasalam. It is clear from its definition that Ijma can only occur after the demise of the Prophet Allah Sallallahu Alahi Wasalam. For during his lifetime, the Prophet was the highest authority on Sharia Law, hence the agreement and the disagreement of others did not affect the overriding authority of the Prophet. Following the demise of the Prophet Muhammad in the year 632, the Companions used to consult each other about the problems they encountered and their collective agreement was accepted by the community. After the Companions, this leadership role passed on to the next generation, the Successors and then to the second generations of Successors.
In this way a fertile ground was created for the development of the theory of Ijma. The essence of Ijma lies in the natural growth of ideas. It begins with the personal opinions of the jurists and culminates in the universal acceptance of a particular opinion over a period of time. Differences of opinion are tolerated until a consensus emerges, and in the process there is no room for compulsion or the imposition of ideas upon the community. (M.H. Kamali in his book Principles of Islamic Jurisprudence, p.231)
There is evidence from the Qur’an which indicates to the validity and establishing of this principle of the Sharia. For example, God says:
“Obey God and obey the Prophet and those who are in charge of affairs among you. Should you happen to dispute over something, then refer it to Allah and to the Prophet.” (Surah Nisa v.58 – v.59)
According to the famous Companion Ibn Abbas May God Be Pleased with Him considers this verse to be referring to the Islamic scholars.
Similarly, the Prophet of Allah Sallallahu Alahi Wasalam Companion Abu Bakr Radiallahu Anhu when he could not find a clear cut ruling on a matter in the Qur’an or the Sunnah, then he would consult with the senior and prominent Companions, and he would rule on the consensus reached. (Sunan Darimi)
The hadiths which you quoted in the question is referring to the validity of Ijma when it comes to Islamic rulings. The hadith is informing us to act upon the rulings of the majority of the scholars.
Only Allah Knows Best
Mohammed Tosir Miah
Darul Ifta Birmingham.