The basis of steadfastness is in three things: following the Book [of Allah], the Sunnah, and holding on to the jama’ah.
The meaning of “holding on to the jama’ah is to remain attached to the truth and the upholders of truth even though they may be small in number. It does not mean that you have to join or remain attached to the majority. Many people err in understanding this. I have therefore brought your attention to this. Imam ibn Hazm rahimahullah says:
“The jama’ah and the group refers to the people of truth. Even if there may be only one of them in this entire world, they will be referred to as the jama’ah and the group. When only Abu Bakr (may Allah be pleased with him) and Khadijah (may Allah be pleased with her) embraced Islam, they were the jama’ah while the rest of the world apart from them and apart from Rasulullah (may Allah send peace and salutations upon him) , were those who were against the jama’ah and were separated from the jama’ah. There is no difference whatsoever among the ‘ulema regarding what we said in this regard.”
Imam ibn al-Qayyim rahimahullah says: “Look at the wonderful words of Abu Shamah in his book al Hawadith wa al Bida’, with regard to the order to hold on to the jama’ah. “It means clinging to the truth and following it even if those holding onto it are few while those opposing it are many. This is because the truth was always what the first jama’ah was on from the time the Prophet (may Allah send peace and salutations upon him) and the Sahabah (may Allah be pleased with them). This is irrespective of how large the number of those involved in innovations (ahl al bida’) may be.”
‘Amr ibn Maymum al Audi said: “I remained in the company of Mu’adh [may Allah be pleased with him] in Yemen. I did not leave him until I threw sand over his grave [when he passed away] in Syria, I then remained in the company of one of the most intelligent people, ‘Abdullah ibn Mas’ud (may Allah be pleased with him). I heard him saying: ‘Hold on firmly to the jama’ah because the hand of Allah is on the jama’ah.’ Then one day I heard him saying: ‘There shall rule over you such rulers who will delay the salah from its appointed times. You should therefore offer salah at its appointed time which is compulsory (fard) salah. You should then offer the salah with them [at the time appointed by the rulers] for it will be the optional salah for you.’”
‘Amr ibn al Maymum says: “So I asked, O companions of Muhammad [may Allah send peace and blessings upon him] , I do not know what you are saying to us.” He [‘Abdullah ibn Mas’ud (may allah be pleased with him)] asked: “What do you mean?” I replied: “You are ordering me to adhere to the jama’ah and encouraging me to follow it. And then you are telling me to offer my salah individually despite it being the compulsory salah, and to offer salah with the jama’ah which is and optional salah?!”
He replied: “O ‘Amr ibn Maymun! I thought that you were the most intelligent person in this village. Do you know what the jama’ah is?” I replied: “No.” He said: “The jama’ah is what confirms to the truth even if you are all alone.” In another narration, the words are: “He then struck me on my thigh and said: ‘I am disappointed with you. The majority of the people have left the jama’ah. Surely the jama’ah is that which concurs with the obedience of Allah.”
Nu’aym ibn Hammad said: “If the jama’ah degenerates you should hold on to what the jama’ah was on before it degenerated, even if you are all alone. For you are the jama’ah at such time.”
Al-Khatib al-Bagdadi narrates from Ibn Mas’ud (may Allah be pleased with him) that he said: “The jama’ah is the the Quran and the Sunnah even if you are all alone.” In another narration: “The jama’ah refers to those who hold on to the truth even if you are all alone.”
Ibn al-Qayyim also quoted similar words. The gist of what he said thereafter is as follows: “Some people have made the Sunnah into bid’ah (innovation) and good into evil because there are so few [who adhere to the Sunnah and to good] and because they are in the minority in the different eras and places. The claim and say: ‘Those who remain isolated [in this world] shall be isolated in the hell-fire.’ But they do not know that an isolated person is who opposes the truth. Therefore , if all the people except one person opposes truth, then they [all the people] are the ones who are isolated. While that one person is the jama’ah.”
“People in general, except for a small group , remained isolated in the time of Imam Ahmad ibn Hanbal. So that group was actually the jama’ah. While the judges, the muftis, the caliph and their followers were the ones who remained isolated. Imam Ahmad ibn Hanbal rahimahullah alone was the jama’ah. When the intelligence of the people could not understand this , they said to the caliph: ‘O Leader of the Believers! Are you, you judges, your ministers, the jurists and the muftis all on falsehood while Ahmad alone is on the truth?’ His knowledge could not comprehend this. He therefore began flogging Imam Ahmad and torturing him after having imprisoned him for a long time.” The truth and those supporting the truth were then victorious and the claims of the caliph and his supporters proved wrong.
(The Sunnah Way of the Sufis, Shaykh ‘Abd al Fattah Abu Ghudda)
 Ibn Hazm: al-Ihkam fi Usul al-Ahkam, vol. 5, p. 87
 Ibn al-Qayyim: Igatha al-Lahfan min Masayid ash Shaytan, vol. 1, p.69.
 Narrated by al-Bayhaqi and others. Also narrated by al-Lalika’i in the book, as-Sunnah, vol. 1 , p. 109 which is printed under the title Sharh Usul I’tiqad Ahl as-Sunnah wa al-Jama’ah.
 Al-Khatib al-Bagdadi: al-Faqih wa al-Mutafaqqih, vol. 2, p. 191
 Ibn al-Qayyim: I’lam al Muwaqqi’in, vol. 3, p. 409