As for after the death of the Prophet:
Hadith.611 - It was narrated from Juwayriyah ibn Mus-hir that He said:
"We were coming with The Commander of the Faithful Imam Ali ibn Abi Talib
عليه السلام, from the battle with the Khawarij. When we reached the land of Babil (Babylon), the time for Asr prayer approached.
The Commander of the Faithful Imam Ali ibn Abi Talib
عليه السلام dismounted, and the people dismounted as well.
Imam Ali ibn Abi Talib
عليه السلام, said: 'O’ people, this is a cursed land that has been punished three times in the past' (in another version, 'twice, and it is expecting a third punishment'). 'It is one of the overturned lands, and it was the first land where an idol was worshipped. It is not permissible for a prophet or the successor of a prophet to pray in it. Whoever among you wishes to pray may do so.'
So, the people moved to the sides of the path to pray, while He
عليه السلام mounted the mule of the Messenger of Allah
صلى الله عليه وعلى آله وسلم and continued on.
Juwayriyah said: 'I said to myself, "By Allah
سبحانه وتعالى, I will follow The Commander of the Faithful Imam Ali ibn Abi Talib
عليه السلام and will imitate his prayer today."
So, I went after him. By Allah
سبحانه وتعالى, we did not cross the bridge of Surah until the sun had set, and I began to doubt.'
He (Ali) turned to me and said: 'Juwayriyah, do you doubt?'
I replied: 'Yes, O’ Commander of the Faithful (Imam Ali ibn Abi Talib
عليه السلام)‘.
He dismounted, performed ablution, stood, and uttered words that I did not understand, as if they were in Hebrew.
Then he called for prayer, and I saw, by Allah
سبحانه وتعالى, the sun emerge from between two mountains, making a sound as it rose.
He then prayed the Asr prayer, and I prayed with him. When we finished our prayer, the night returned to how it was.
He turned to me and said: 'Juwayriyah ibn Mus-hir, Allah
سبحانه وتعالى, the Mighty and Majestic, says: "So exalt the name of your Lord
عز وجل, the Most Great" (Qur'an
56:74). I asked Allah
سبحانه وتعالى, the Mighty and Majestic, by His Greatest Name, and He returned the sun for me.'
It is narrated that when Juwayriyah witnessed this, He said:
'By the Lord
عز وجل of the Kaaba, you are the successor of a prophet.'"