Sayyiduna Anas bin Malik (may Allah be pleased with him) narrated that the Messenger of Allah (peace and blessings be upon him) came while we were in a house, and every one of us moved back from his place so that the Messenger of Allah (peace and blessings be upon him) would sit next to him. He (peace and blessings be upon him) stood at the door and said: "The rulers (imams) shall be from Quraysh. They have a right, and I too have a right, as long as they do three things: when they judge, they judge with justice; when they make a covenant, they fulfil it; and when mercy is asked of them, they show mercy. Whoever among them does not do so, upon him be the curse of Allah, the angels and all mankind."
Hadith Referenceالمعجم الكبير للطبراني / باب الألف / 721