Praise be to Allah.
The obligation of following the Qur’an and Sunnah does not contradict the idea of learning from the Companions of the Messenger of Allah (blessings and peace of Allah be upon him) and from the imams who are known to have been men of knowledge and virtue. In fact learning from them in general comes under the heading of following the Qur’an and Sunnah. Allah, may He be exalted, says (interpretation of the meaning):
“so ask people who know the Scripture, if you do not know”
Abu Dawood (3641) narrated that Abu’d-Darda’ said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “…The scholars are the heirs of the Prophets. The Prophets did not leave behind dinars or dirhams, rather they left behind a heritage of knowledge, and the one who acquires it acquires an abundant portion.”
Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
The view of this scholar, – whether he was a Sahaabi or otherwise – can only have been either in accordance with the Sunnah or at variance with it. If it is in accordance with it, then it is obligatory to adopt it and act upon it, because the scholars have more knowledge of Allah and His Messenger than anyone else.
If it is at variance with the Sunnah then it should not be adopted; rather one should follow the Sunnah, but this applies only when it becomes clear to one that this particular opinion is at variance with the Sunnah.
The basic principle is that the opinion of anyone may be accepted or rejected, except the Messenger of Allah (blessings and peace of Allah be upon him).
At the same time the high status of the scholars – foremost among whom are the Sahaabah (may Allah be pleased with them) – must be upheld.
If there is no text concerning the issue, then the opinion of the knowledgeable Sahaabi, if no one else among the Sahaabah differed with him, is regarded as binding evidence according to many scholars.
The basic principle concerning this matter is that the opinion of the Sahaabi is regarded as binding evidence so long as it does not go against any text and so long as no one else among the Sahaabah differed with him.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If the Sahaabi was one of those who were well-known for deep knowledge, then his opinion may be regarded as evidence, subject to two conditions:
(i) that it should not contradict the words of Allah or His Messenger; if it does contradict the words of Allah or His Messenger then it must be rejected, and the words of Allah or His Messenger must be accepted;
(ii) that it should not contradict the view of another Sahaabi; if it does contradict the view of another Sahaabi, then it is essential to determine which is more correct, because the view of one is not regarded as more acceptable than the view of another.
End quote from Liqa’ al-Baab al-Maftooh, 59’24
Similarly their opinions (may Allah be pleased with them) concerning the reasons for revelation and commentary on the Qur’an and Sunnah are regarded as binding evidence, because they are more knowledgeable about the Revelation and the language of the Arabs; the Qur’an was revealed among them and they lived with the Prophet (blessings and peace of Allah be upon him), so they are more knowledgeable about his Sunnah.
With regard to scholars other than the Sahaabah, they are the most knowledgeable of people about the Qur’an and Sunnah, and the most skilled of the people in sound analogy, and the most capable of the people of deriving rulings in a proper manner? Allah, may He be exalted, says (interpretation of the meaning):
“if only they had referred it to the Messenger or to those charged with authority among them, the proper investigators would have understood it from them (directly)”
As-Sa‘di (may Allah have mercy on him) said:
This verse establishes a guideline, which is that if research is to be undertaken into some matter, it should be done by one who is qualified to do it, and no one should take on this task except them, because they are more likely to reach the right conclusion and to avoid errors.
End quote from Tafseer as-Sa‘di, p. 190
Reference should be made to people of knowledge and we should be content with their opinions on issues that are difficult or ambiguous, because the one who does not have the proper background in knowledge and specialist experience has no right to express a view on these matters. Hence the Messenger (blessings and peace of Allah be upon him) instructed us to refer questions about anything that is unclear to us in the Book of Allah or the Sunnah of His Messenger to those who have knowledge thereof:
It was narrated from ‘Amr ibn Shu‘ayb, from his father, that his grandfather said: The Prophet (blessings and peace of Allah be upon him) heard some people disputing and said: “Those who came before you were only destroyed because of this; they used one part of the Book of Allaah against another. But the Book of Allah was revealed so that one part of it would confirm another, so do not use one part to oppose another. Whatever you learn from it, speak of it, and whatever you do not understand of it, refer it to one who does know it.”
Narrated by Ahmad (6702) and Ibn Maajah (85); classed as hasan by al-Albaani in Mishkaat al-Masaabeeh, 237
Shyakh Mulla ‘Ali al-Qaari (may Allah have mercy on him) said:
“refer it” means take your questions about the matter
“to one who does know it”, namely Allah, may He be exalted, or one who is more knowledgeable than you among the scholars, and do not try to work out its meaning by yourselves.
End quote from Mirqaat al-Mafaateeh, 1/313
To conclude, if the scholars are unanimously agreed on the meaning of a verse or hadeeth, or on confirmation of the validity or otherwise of a shar‘i ruling, this is binding shar‘i proof, because the ummah cannot agree on misguidance.
But if they differ, then the criterion for judging between different words, actions and circumstances is the Book of Allah and the Sunnah of His Messenger (blessings and peace of Allah be upon him). Whatever scholarly opinion is more in harmony with the Qur’an and Sunnah must be followed, and whatever is contrary to the Qur’an and Sunnah must be rejected, whilst affirming that all the scholars possess knowledge, virtue, dignity and religious commitment, and that they are the ones whom Allah chose to protect His religion, take care of His laws and rulings, and affirm them among the people.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
If the Muslims dispute concerning an issue, the matter concerning which they dispute should be referred to Allah and the Messenger; whichever of the two opinions is supported by the Qur’an and Sunnah must be followed.
End quote from Majmoo‘ al-Fataawa, 20/12
Shaykh Ibn Baaz (may Allah have mercy on him) said:
If evidence is established concerning some matter, it is obligatory to follow the evidence that is established from the Book of Allah or the Sunnah of His Messenger (blessings and peace of Allah be upon him) even if that differs from a prominent imam and even if it differs from some of the Sahaabah. Allah says (interpretation of the meaning):
“(And) if you differ in anything amongst yourselves, refer it to Allah and His Messenger”
and He did not say: Refer it to So and so, or So and so.
But it is essential to affirm and respect the scholars, and to observe proper etiquette with them. If an individual finds a weak opinion with one of the prominent imams, scholars or muhaddiths (scholars of hadeeth), that should not detract from their status, and he should still respect the scholars, observe proper etiquette with them and speak well of them. He should not revile them or look down on them; rather he should explain the truth with evidence whilst offering supplication for the scholar, praying for mercy for him and asking Allah to forgive him.
This is also how the attitude of scholars should be to other scholars: they should respect the scholars for their status and acknowledge their position and virtue.
End quote from Majmoo‘ Fataawa Ibn Baaz, 26/305
For more information please see the answer to question no. 128658
And Allah knows best.