It is narrated from Sayyiduna Ibn Amr, may Allah be pleased with him, that the Noble Prophet, peace and blessings be upon him, said: "Whoever gives allegiance to an Imam and gives him the pledge of his hand and the sincerity of his heart, then he should obey him as much as he can."