It is narrated from Sayyiduna Amr al-Bikali (may Allah be pleased with him); he said: I heard the Messenger of Allah (peace and blessings be upon him) say: "When you have rulers over you who command you to pray, to pay zakah and to perform jihad, then Allah has forbidden you to revile them and has made it lawful for you to pray behind them."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14162
Abu Tamimah (may Allah have mercy on him) said: I came to Syria seeking a stipend (from the treasury), and I saw a man around whom people had crowded. I asked: "Who is this?" They said: "This is Amr al-Bikali, whose hand was wounded on the day of Yarmuk, the day the Romans were driven out of Syria." I heard him say: The Messenger of Allah (peace and blessings be upon him) said: "When you have rulers over you who command you to pray, to give zakah and to strive (jihad) in the path of Allah, then praying behind them is lawful for you, and reviling them is forbidden to you."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14163