Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "Whatever prophet or caliph Allah Almighty appointed, he had two confidants: one who commands him to good and urges him to it, and another who commands him to evil and urges him to it; and the protected one is he whom Allah Almighty protects."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20314