Suwayd b. Ghaflah reports that ‘Umar b. Al-Khattâb – Allâh be pleased with him – once took him by the hand and said:

O Abû Umayah, by Allâh, I know not if we will meet again after today. Fear and obey Allâh your Lord until the Day of Resurrection, as if you see Him, and obey the ruler (imâm) even if he is a cut-nosed Abyssinian slave: if he beats you, be patient; if he robs you, be patient and if he belittles you, be patient. And if he tells you [to do something] to the detriment of your religion (to sin), say: “I hear and obey, [but] my blood goes before my religion.” Never leave the Main Muslim Body (Al-Jamâ’ah).

Ibn Zanjawayh, Kitâb Al-Amwâl article 30; Ibn Abî Zamanîn, Usûl Al-Sunnah article 205 with a slight variation in wording. Also recorded in other collections.