Ever since former Trump national security adviser Michael Flynn was arrested for lying to FBI agents, I have argued that he had a strong defense to that charge: namely, that his lies were not material because the FBI questioned him for an illegitimate purpose - to give him an opportunity to lie, rather than to obtain information it did not already have.

The question posed by the Flynn case is whether a lie can be material if the FBI already had indisputable evidence of the truthful answer and asked him the question for the sole purpose of giving him an opportunity to lie.

As a civil libertarian, I believe the answer should be "No." The proper function of an FBI or a grand jury interrogation is to obtain information they do not already have, and not to create a new crime by giving the suspect the opportunity to pass or fail a morality test with criminal consequences. Related to materiality is the claim that a suspect cannot be convicted if the question was not within the proper function of the law enforcement agency that asked it.

My position has been attacked as lacking any basis in law. The influential legal blog, Above the Law, wrote an article titled "Dershowitz Invents New Materiality Standard to Protect Trump Cronies-Even Fox News Host Seems to Laugh it Off." In it, the blogger wrote: "Professor Dershowitz decided to lend his spin to whatever narrative the Trump defense team outlines in exchange for an almost daily dose of Fox News appearances ... materiality does not require investigators to rely upon the false statement. This is not only well-settled, but Dershowitz's interpretation would also be a remarkably dumb standard." Others have echoed these ad hominem attacks.

Well, it turns out that the issue is not "well-settled." Nor did I invent it. In fact, two influential courts - the New York Court of Appeals, in an opinion by one of the most distinguished jurists of the 20th century, and the D.C. district court that is now preparing to sentence Flynn - have sided with my interpretation. (True civil libertarians, however, should be concerned about what the law and policy should be, regardless of whether there is a precedent.)

The logic of the courts is almost identical to the logic of my argument.

In The People v. Tyler, the New York court's Chief Judge Charles Breitel reversed a conviction for perjury of a former public official who had lied about his connection to a well-known gambler. The court reversed the perjury conviction, holding that:

"The primary function of the Grand Jury is to uncover crimes and misconduct in public office for the purpose of prosecution ... It is not properly a principal aim of the Grand Jury, however, to 'create' new crimes in the course of its proceedings. Thus, where a prosecutor exhibits no palpable interest in eliciting facts material to a substantive investigation of crime or official misconduct and substantially tailors his questioning to extract a false answer, a valid perjury prosecution should not lie."

The appeals court cited a district court case in D.C., which held that to interpret "materiality" more broadly would serve no proper legislative purpose. In U.S. v. Icardi, 140 F. Supp. 383, the court held that if "the committee is not pursuing a bona fide legislative purpose when it secures the testimony of any witness, it is not acting as a 'competent tribunal' ... [and] extracting testimony with a view to a perjury prosecution is [not] a valid legislative purpose."

To be sure, there are differences - as there always are - between these cases and the Flynn case. But the logic of the earlier rulings is applicable to the Flynn case: namely, that a lie is not a crime unless it is material and in response to a question that is within the appropriate function of the questioner - and that it is not the proper function of law enforcement to ask questions for the purposes of giving the suspect an opportunity to lie. A judge must instruct a jury that it cannot find a defendant guilty unless it concludes beyond a reasonable doubt that the lie was material.

One can reasonably disagree on these issues, and I am ready to debate which is the better civil-liberty view. What is not acceptable is that whenever I criticize the FBI or special counsel Robert Mueller, my criticism is not met with considered counter-arguments but with ad hominem attacks and with false claims that I am following some narrative of the Trump team. (In fact, it was I, not the Trump legal team, that first articulated this argument.)

These same people who criticize me now would call me a hero, if the 2016 election had turned out differently and this were President Hillary Clinton being investigated. They would applaud my creativity in the interest of civil liberties rather than condemning me for inventing a new argument.

It is simply wrong and dangerous to equate civil-liberty criticism of the FBI and prosecutors with support for Donald Trump.

My views on prosecutorial misconduct have been the same for 50 years. I am a liberal Democrat, and a defender of civil liberties. As such, I criticize - and will continue to criticize - government misconduct, regardless of whether it helps Republicans or Democrats, President Trump or his opponents.

Being principled and intellectually honest means that, sometimes, your positions may conflict with your partisan preferences. For most of my critics, however, it seems that partisanship trumps their fair-weather commitment to civil liberties.

Alan M. Dershowitz is the Felix Frankfurter Professor of Law, Emeritus, at Harvard Law School. He is the author of "Trumped Up: How Criminalizing Politics is Dangerous to Democracy" and "The Case Against Impeaching Trump." He is on Twitter @AlanDersh and Facebook @AlanMDershowitz.