He was asked...
He was asked: “How is it that you are superior to all other companions in the matter of the knowledge of Hadith?” He replied: “It is so because the Prophet told me whatever I enquired from him, and if I did not enquire about anything he himself made it known to me” Ali was superior to all others in the matter of jurisprudence and Islamic learning just as he acted upon them in a better way than others. Those who were his contemporaries did not find a greater jurist and a greater judge than him.
Abu Bakr and Umar always approached him for the solution of difficult problems. These two caliphs benefited much from his knowledge and wisdom. Other companions of the Prophet also consulted him for the solution of their problems. None could put forth better arguments than him with regard to legal problems. As regards jurisprudence Ali's knowledge was not limited to text and orders.
He was more adept than his contemporaries in other branches of learning also, as their knowledge is necessary for a jurist (for example mathematics). Abu Hanifa is called 'the grand Imam' in the capacity of a jurist. He was a pupil of Ali, because he learnt jurisprudence from Imam Ja'far al-Sadiq and the chain of his teachers when taken upwards, ended with Ali. In the same way Malik son of Anas was a pupil of Ali through a few intermediaries. Malik learnt jurisprudence from Rabiya.
He learnt it from Akrama. He learnt it from Abdullah and Abdullah learnt it from Ali. Abdullah son of Abbas, who was the preceptor of all others, was asked: “What is the ratio of your knowledge to that of your cousin i.e. Ali. He replied: “The ratio is the same as exists between a drop and the ocean”. The companions have unanimously quoted the Prophet as saying: “The best judge amongst you is Ali”.
Ali excelled all other persons of his time in matters of law, because he knew the Qur'an and religious rules and regulations better than all others, and in Islam correct judgments depend on these two things. He possessed such intelligence, wisdom and power of thinking that in the event of dispute he could give the most rational judgment. His conscience was so strong that he was capable of giving a conscientious and just decision after examining and understanding various aspects of a matter.
Umar ibn Khattab has been reported to have said: “O Abul Hasan! May that problem be not auspicious for the solution of which you are not available”.