Our court system must always keep a door open for the truth, but too often it is closed.

Under a badly written Illinois law, a person can be charged with perjury for admitting that his or her earlier testimony — even if given many years earlier — was a lie.

That’s problematic, because a fair society wants people to come forward if they’ve caused an injustice by lying under oath. But if they fear going to prison for doing so, you can bet they’ll keep their mouths shut.

In one well-known Cook County case in 1985, a woman named Cathleen Crowell Webb came forward and said she had lied eight years earlier when she accused a man named Gary Dotson of raping her. Authorities didn’t believe her until DNA testing proved Dotson’s innocence in 1988. He finally was pardoned in 2002.

At the time, the Cook County state’s attorney could have prosecuted Webb for perjury, but he didn’t. That turned out to be a wise decision.

Now, former U.S. Attorney and Gov. Jim Thompson, who personally led clemency hearings in 1985 on the Dotson case, is among 23 highly regarded former judges and prosecutors who are worried about a new case that could have a chilling effect on future witnesses who want, finally, to come clean. On April 24, the former judges and prosecutors sent a letter to State’s Attorney Anita Alvarez expressing concern about the perjury prosecution of a man named Willie Johnson.

Johnson, who had a serious criminal record of his own, first testified in 1994 against Cedric Cal and Albert Kirkman when they were on trial for a double murder on the South Side. But seven years later, in 2011, he testified that he had lied because telling the truth back then would have endangered him and his family. By then, Johnson had moved out of Illinois, had been disabled in a car accident, was married and living on Supplemental Social Security Income, and was staying out of trouble. But a judge ruled Johnson’s recantation was not credible, just as an earlier judge had ruled Webb’s recantation was not credible, and Johnson was charged with perjury.

In their letter, the former judges and prosecutors warn that the perjury charges are “contrary to the interests of justice,” and they certainly should know. Their collective experience with our criminal justice system, from all perspectives, is deep, broad and sophisticated. They know of what they speak.

Just as they urge, the perjury charges should be dropped. And the law, we would add, should be rewritten.

The problem with the law is that it says you are automatically guilty of perjury if you give two contradictory statements, even if the second statement is the truthful one and the first is beyond the normal three-year statute of limitations on perjury. That makes doing the right thing a crime. We are reminded of the way government whistleblowers used to be treated, when they could be punished for coming forward even if they were telling the truth.

We’ve seen a parade of exonerations over the years, across the state, in which innocent people were freed from prison — even death row — and a big piece of those exonerations often has rested on admissions from witnesses that they’d lied at the original trials. Often, the witnesses had been persuaded to lie in the first place as a kind of public service — they would be putting a bad guy behind bars.

Our criminal justice system depends on witnesses taking their oaths seriously, and there should be penalties when they do not. It is also true that prosecutors cannot and should not reopen a case every time a witnesses changes a story. As in the Gary Dotson case, where new DNA evidence emerged, something more than a recantation typically is required.

But to discourage recantations that might be true by pressing perjury charges too aggressively — that turns the truth-finding mission of the courts upside down.

Sally Daly, a spokeswoman for Alvarez, said her office uses perjury prosecutions only in rare instances.

“We don’t believe it has a chilling effect, we really don’t,” she said.

We’re not so sure future would-be recanters, finally looking to tell the truth, will see it that way.