In Abrahamic faiths, the concept of pledging allegiance to the Messenger holds significant importance. The Messenger referred to in this context is typically the Prophet Mohammed (PBUH & His Family) in Islam, but similar ideas exist in Judaism and Christianity regarding their respective Prophets or Messengers.
In Islam, pledging allegiance to the messenger refers to the act of expressing loyalty and obedience to Prophet Mohammed (PBUH & His Family) as the final Messenger of God. This allegiance is manifested through the declaration of faith known as the Shahada, which states, "There is no god but Allah, and Mohammed is the Messenger of Allah." And it is well known that the people pledged their allegiance to the Prophet (PBUH & His Family).
“Certainly was Allah pleased with the believers when they pledged allegiance to you, [O Muhammad], under the tree, and He knew what was in their hearts, so He sent down tranquility upon them and rewarded them with an imminent conquest”
– The Holy Qur'an, Chapter 48 (Al-Fath), Verse 18
“O Prophet, when the believing women come to you pledging to you that they will not associate anything with Allah, nor will they steal, nor will they commit unlawful sexual intercourse, nor will they kill their children, nor will they bring forth a slander they have invented between their arms and legs, nor will they disobey you in what is right - then accept their pledge and ask forgiveness for them of Allah. Indeed, Allah is Forgiving and Merciful.”
– The Holy Qur'an, Chapter 60 (Al-Mumtahanah), Verse 12
It has been reported on the authority of Nafi, that 'Abdullah b. Umar paid a visit to Abdullah b. Muti' in the days (when atrocities were perpetrated on the People Of Medina) at Harra in the time of Yazid b. Mu'awiya. Ibn Muti' said:
Place a pillow for Abu 'Abd al-Rahman (family name of 'Abdullah b. 'Umar). But the latter said: I have not come to sit with you. I have come to you to tell you a tradition I heard from the Messenger of Allah. I heard him say: One who withdraws his band from obedience (to the Amir) will find no argument (in his defence) when he stands before Allah on the Day of Judgment, and one who dies without having bound himself by an oath of allegiance (to an Amir) will die the death of one belonging to the days of Jahillyya.
– Sahih Muslim, Muslim ibn Al-Hajjaj Al-Naysaburi, Book 33, Hadith 90
And there are narrations that state that pledging allegiance to the Mahdi is a divine obligation upon the people.
From Thawban that the Prophet of Allah (PBUH & His Family) said:
“Three will fight at your treasure, all of them are the sons of a caliph, then it will not be to anyone of them, then the black banners will rise from the east, and they will fight a fight that no nation has fought before”. Then he mentioned something and said: “If you see him, pledge allegiance to him even if crawling on ice, verily he is the Caliph of Allah the Mahdi”.
– Al-Mustadrak Ala Al-Sahihayn, Al-Hakim al-Nishapuri, Vol. 4, p. 510, hadith 8432 (Online book: p. 464); Kanz Al-Ummal, Al-Muttaqi Al-Hindi, Vol. 14, p. 263, hadith 38658; Sunan Ibn Majah, Ibn Majah, Book of Tribulations, Hadith 4084
It was narrated that 'Abdullah said:
"While we were with the Messenger of Allah, some youngsters from Banu Hashim came along. When the Prophet saw them, his eyes filled with tears and his color changed. I said: 'We still see something in your face that we do not like (to see).' He said: 'We are members of a Household for whom Allah has chosen the Hereafter over this world. The people of my Household will face calamity, expulsion and exile after I am gone, until some people will come from the east carrying black banners. They will ask for something good but will not be given it. Then they will fight and will be victorious, then they will be given what they wanted, but they will not accept it and will give leadership to a man from my family. Then they will fill it with justice just as it was filled with injustice. Whoever among you lives to see that, let him go to them even if he has to crawl over snow.'"
– Sunan Ibn Majah, Ibn Majah, Book of Tribulations, Hadith 4082
– Bihar Al-Anwar, Muhammad Baqir Al-Majlisi, Vol. 51, pp. 82-83, hadith 27
For the Shia Muslims, there is a well-known supplication called, Dua Ahad, which is a Supplication of Allegiance (Ahad) to Imam Mahdi (PBUH & His Family). In it the supplicant say:
اَللَّهُمَّ إِنِّي أُجَدِّدُ لَهُ فِي صَبِيحَةِ يَوْمِي هٰذَا
allahumma inni ujaddidu lahu fi sabihati yawmi hadhaO Allah, I update to him in the beginning of this day
وَمَا عِشْتُ مِنْ أَيَّامِي
wa ma `ishtu min ayyami
and throughout the days of lifetime a pledge,
عَهْداً وَعَقْداً وَبَيْعَةً لَهُ فِي عُنُقِي
`ahdan wa `aqdan wa bay`atan lahu fi `unuqi
a covenant, and allegiance to which I commit myself
لا أَحُولُ عنها وَلا أَزُولُ أَبَداً
la ahulu `anhu wa la azulu abadan
and from which I neither convert nor change.
– Dua Ahad
And Prophet Mohammed (PBUH & His Family) said:
“Whoever dies and doesn’t pledge allegiance to the Imam of his time has died the death of ignorance."
– Al-Aql wa Al-Jahl fi Al-Kitab wa Al-Sunnah, Mohammed Al-Reyshahri, p. 275