Allah [may He be Glorified] said:
“And in whatsoever you differ, the decision thereof is with Allâh (He is the ruling Judge). (And say O Muhammad (peace be upon him) to these polytheists:) Such is Allâh, my Lord in Whom I put my trust, and to Him I turn (in all of my affairs and) in repentance.” (42:10)
“And in whatsoever you differ” i.e. anything of the basics of religion and its subsidiaries in which you differ.
“The decision thereof is with Allah” i.e. everything should be referred to the Book of Allah and to the Sunnah of His Messenger (peace be upon him). Whatever their judgement may be, it should be accepted to the exclusion of any other judgement.
“Such is Allah, my Lord” i.e. He is the Lord Who created mankind, provided them with sustenance and disposes of all affairs. He is also the One Who decides for His slaves by means of His legislation that covers all of their affairs.
This verse is an obvious evidence that the consensus of the Ummah on any thing is a valid proof that should be applied, because Allah [may He be Glorified] did not command us to return to His Book except when there is a difference regarding anything. Whatever the Ummah agreed upon should therefore be adopted because the entire Ummah cannot agree on an error or on something that contradicts the rulings of the Book of Allah or the Sunnah of His Messenger (peace be upon him).
“In Whom I put my trust” i.e. he (peace be upon him) and every Muslim should depend on Allah, believing that He Alone is the One that can bring about any good or prevent any harm.
“And to Him I turn in repentance” i.e. he (peace be upon him) and every Muslim should turn to Allah with their hearts and bodies obeying and worshipping Him Alone.
Thus, reliance and repentance are two great principles, which are often mentioned in the Book of Allah, because if they gather in a person he will result in his perfection. Otherwise, he will be imperfect and inefficient. Allah [may He be Glorified] said: “You (Alone) we worship, and You (Alone) we ask for help (for each and everything).” (1:5) He also said: “So worship Him (O Muhammad (peace be upon him)).” (11:123) and put your trust in Him”.
See Tafsir Ibn Sa’di, p.699. (Al-Luwaihiq Edition).