‘Ali said:
God's Messenger sent me to the Yemen as qadi and I said, “Messenger of God, are you sending me when I am young and have no knowledge of the duties of qadi He replied, “God will guide your heart and keep your tongue true. When two men bring a case before you do not decide in favour of the first till you hear what the other has to say, for it is best that you should have a clear idea of the best decision." He said he had no doubts about a decision afterwards.
Tirmidhi, Abu Dawud and Ibn Majah transmitted it.