structural:scholar_edition, quality:corruption
Adulthood and death

In 763, al-Mansur, the Abbasid caliph offered Abu Hanifa the post of qadi al-qudat (chief judge of the state), but he declined the offer, choosing to remain independent. His student Abu Yusuf was later appointed to the post by Caliph Harun al-Rashid.

In his reply to al-Mansur, Abu Hanifa said that he was not fit for the post. Al-Mansur, who had his own ideas and reasons for offering the post accused Abu Hanifa of lying.

"If I am lying," Abu Hanifa responded, "then my statement is doubly correct. How can you appoint a liar to the exalted post of a Qadi (Chief Judge)?"

Incensed by this reply, al-Mansur had Abu Hanifa arrested, locked in prison and tortured. It was said that once in prison he was never fed nor cared for. Even in prison, the jurist continued to teach those who were permitted to visit him.

On 15 Rajab 150, (15 August 767) Abu Hanifa died in prison. The cause of his death is not clear, as it was said by some that Abu Hanifa issued a legal opinion for bearing arms against al-Mansur, so al-Mansur had him poisoned. His fellow prisoner and founder of Karaite Judaism, Anan ben David, was said to have received life-saving counsel from Abu Hanifa. It was said that so many people attended his funeral that the funeral service was repeated six times for the more than 50,000 people who had massed before he was actually buried. The historian al-Khatib said that for a full 20 days people performed funeral prayers for him. Many years later, the Abu Hanifa Mosque was built in the Adhamiyah neighbourhood of Baghdad. Abu Hanifa also supported the cause of Zayd ibn Ali and Ibrahim al Qamar, both Alid Zaydi Imams.

The structures of the tombs of Abu Hanifa and Abdul Qadir Gilani were destroyed by Shah Ismail of the Safavid Empire in 1508. In 1533, the Ottomans conquered Baghdad and rebuilt the tombs of Abu Hanifa and Abdul Qadir, as well as other Sunni sites.