Sayyiduna Ali (may Allah be pleased with him) said: When the Prophet (peace and blessings be upon him) sent me to Yemen, I said: "You (peace and blessings be upon him) are sending me as a judge, while I do not have much knowledge of judging." He (peace and blessings be upon him) said to me: "Judge after hearing what both disputing parties say. You will know how to judge. Allah will keep your tongue firm and guide your heart." Sayyiduna Ali (may Allah be pleased with him) said: After that I continued judging in this way.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20488