Imaam Abu Hanifah رحمة الله عليه is imprisoned by the Khaleefah

Imaam Abu Hanifah رحمة الله عليه is imprisoned by the Khaleefah

The king of that time, Khaleefah Mansoor had imprisoned Imaam
Sahib (رحمة الله‎) and ordered that he be lashed ten times daily. The reason for imprisoning him was that whenever the king enforced a
law, the general masses would approach Imaam Sahib رحمة الله عليه and
enquire if the law was conforming to the Shari`ah or not. If it was
conforming to the Shari`ah, they would practise on it. Otherwise,
they would reject it. The king had appointed a police inspector to
punish those who opposed his laws. Hence, the police punished those
who opposed the royal decree.

Once, the inspector came to Imaam Sahib رحمة الله عليه and asked, “Hadhrat, will my toubah (repentance) be
accepted?” Imaam Sahib رحمة الله عليه responded, “Make a firm resolution
that in future you will never do such a thing again. Allah Ta`ala will forgive you.” Thereafter, he repented for his actions.

After some time, the king issued another law. He called his inspector
and said, “We have issued a certain law. So prepare for your task (i.e.
whoever opposes it, punish him).” The inspector said, “I will give you an answer tomorrow.”

That evening he came to Imaam Sahib رحمةالله عليه and asked him that since the king had given him such a command, what should he do?

Imaam Sahib رحمة الله عليه told him, “This is the time of your test, to determine whether your toubah was true or not.” Hearing this he said, “Well, I will not go ahead with this
command.”
Hence, in the morning he went to the king and rejected his command saying, “I am not prepared to do this work.”
The king instructed his advisors to investigate who had changed his mind.
They discovered that he went to Imaam Sahib رحمة الله عليه for advice.

Hearing this, the king said, “Okay! We will appoint Imaam Abu Hanifah رحمة الله عليه
as the judge of the kingdom and through him, will we introduce our laws and regulations.” Hence, he appointed Imaam Sahib as the royal judge, but Hadhrat Imaam Abu Hanifah رحمة الله عليه
declined the offer saying, “I am not worthy of such a lofty post.”
The king replied, “You are speaking lies. You are worthy of it.” Imaam Sahib رحمة الله عليه said, “If I am speaking lies, then my claim is true
because a liar is not worthy (of this post).” The king persisted and insisted, but Imaam Sahib رحمة الله عليه remained firm.

Eventually, when Imaam Sahib رحمة الله عليه did not accept, the king had him imprisoned and lashed him daily.

Daily, one thousand students would visit him in jail to learn their lessons. When the king learnt of this, he became extremely perturbed
thinking that Imaam Sahib رحمة الله عليه may revolt against him.

Therefore,he decided to poison Imaam Sahib رحمة الله عليه .
When the utensil containing the poison was brought before him, he realised what it was through kashf (divine inspiration) and refused to drink it.
However, he was forcefully made to drink it. Immediately after drinking it, he fell into sajdah and in this very condition, he passed away.

Source: Malfoozaat of Faqeeh-ul-Ummat