Former Major League Baseball pitcher Roger Clemens stops to sign a baseball for a fan as he leaves the federal courthouse Friday. (JONATHAN ERNST/REUTERS)

The most shocking, inexplicable error in modern baseball history has taken place in a courtroom, not on a field.

On Thursday, the prosecution in the perjury case of United States v. Clemens committed an unforced gaffe so stunning that the sports world, and no doubt the legal community, will oscillate between pity and ridicule, incredulity and laughter, for years.

Mistrial. Case thrown out of court.

“I think that a first-year law student would know you can’t bolster the credibility of one witness with clearly inadmissible evidence,” U.S. District Judge Reggie B. Walton said.

Especially when the judge has specifically warned the prosecution against doing that before the trial ever began.

A hearing has been set for Sept. 2 to decide whether Clemens can be retried or whether that would constitute double jeopardy, which would allow Clemens to simply walk away from this entire nightmare.

The dominant impression of this thunderclap day is that Clemens dodged a hail of legal beanballs without ever moving. His own sport has clearly considered him guilty of cheating for more than three years. With no motive to unearth evidence against its only seven-time Cy Young Award winner, baseball ended up with Clemens as the centerpiece of its Mitchell Report simply because so much evidence against him fell in its lap.

Now, after the government has spent months and millions to assemble every shred of negative information about him that it could muster, Clemens not only was gifted a mistrial but received it before the prosecution could send even one witness to the stand to tarnish him. If this blunder had occurred 10, 20 or 30 days into a trial, how much would those 45 government witnesses have said to damage his legacy?

If a retrial is denied, those voices may be mute forever.

Double jeopardy law can be complex. If prosecutors try to create a mistrial or goad the defense into seeking one as a tactic to “get another bite of the apple,” then the defendant might indeed end up walking away without a second trial. But if the mistake is just a blunder by the prosecutors, sometimes there is still a second trial. There are many variations. Right now, it’s probably too soon to know.

What’s certain is that, while some drama arrives in the ninth inning, this trial barely got past the lineup cards. Less than 24 hours after opening statements were heard, Walton suddenly stopped the proceedings and declared a mistrial because of a mistake so elementary and fundamental that he berated the prosecutors in open court.

If you think a slow-hopping groundball is an easy chance, wait until you grasp what the prosecution messed up, demolishing its own expensive taxpayer-funded foundation. Some say this case should never have been brought. But once it reached Courtroom 16, many considered the prosecution to be a lock — or maybe a lockup for Clemens.

One important piece of evidence was Andy Pettitte’s testimony that Clemens had told him he had taken human growth hormone. In previous proceedings, Pettitte’s wife Laura signed an affidavit affirming that her husband told her of the conversation the day it occurred.

But in pretrial decisions, Walton ruled that, because Laura Pettitte hadn’t heard the conversation directly, her testimony would be inadmissible.

So, what did the prosecution do? They apparently tried to go through a backdoor by showing the jury a video of Rep. Elijah Cummings (D-Md.) at the 2008 congressional hearings in which Clemens referred to Pettitte’s conversation with his wife. Laura Pettitte’s affidavit appeared on the courtroom monitor. And there it stayed in full view.

As the prosecution drove itself off a 10,000-foot cliff, Clemens’s renowned attorney, Rusty Hardin, said absolutely nothing. And certainly not “objection.” No doubt, time and lore will eventually decided whether Hardin’s silence was brilliance or, at least as likely, that he was as stunned by the snafu as anybody else.

Judges hate mistrials and want to avoid them. Walton’s comment about “a first-year law student” will probably seal the verdict on the work of the prosecution, led by Assistant U.S. Attorney Steven Durham. Presumably, the entire prosecution team is in this together.

The prosecution suggested their mistake could be fixed by telling the jury to ignore the video evidence. But Walton said he couldn’t know what impact the inadmissible evidence would have on the jury “when we’ve got a man’s liberty at interest.

“I don’t see how I can unring the bell,” Walton said.

Perhaps the most famous, or infamous, game that Clemens ever pitched was Game 6 of the ’86 World Series that he started for Boston. That was the night Boston’s Bill Buckner — a distinguished player with 2,715 career hits, a batting title and the grit to play injured in that game — allowed a groundball to go through his legs for the sport’s most notorious error. On the life-isn’t-fair-even-in-sports meter, the grief he’s taken the past 25 years ranks high on the list. Look for excuses, like this, to speak well of Buckner.

But at least Buckner made $785,000 that season. On the list of people who do society’s tough grunt work, don’t U.S. attorneys get a place? It’s impossible not to beat up the prosecution in the immediate aftermath of what legal experts are racing to declare incompetence.

Just for an ounce of balance, though surely not a pound, let’s note that the defendant who may have beaten the rap on a fluke Thursday was not Al Capone nor Bernie Madoff.

It was a baseball pitcher who may have cheated at his game, then lied about it.

When we have a choice between clobbering the United States v. Clemens culprits with a baseball bat or a quip, maybe stick with the joke.

At least, for most dumbfounding error, Buckner may finally be off the hook.