A defendant in a Central California burglary case walked out of a courtroom a free man after a jury mistakenly signed a not-guilty verdict form, even though it was hung and could not reach a verdict.

The flabbergasted judge said Wednesday he had no choice but to order defendant Bobby Lee Pearson to be released from jail because the not-guilty verdict had been put on the record, The Fresno Bee reported ( http://bit.ly/1s8cZjP).

After it was too late, jurors told the judge they were hung on the charges against Pearson. Prosecutors might have had an opportunity to retry Pearson in the case of a hung jury.

“I can’t believe it,” Superior Court Judge W. Kent Hamlin said after he ordered Pearson to be set free.

Hamlin said he couldn’t change the form because double jeopardy was already attached.

“This has never happened to me in more than 100 jury trials that I have done,” he said.

Pearson and two co-defendants were accused of burglarizing an apartment last year and stealing a video system and a gun. The homeowner allegedly caught the three intruders in the act and wrestled with one of them.

Jurors returned a guilty verdict against Pearson’s co-defendant, Terrel Minniweather, and the mistaken not guilty verdict against Pearson before lunch on Wednesday.

Hamlin asked each juror whether that was in fact their verdict against Pearson, and each nodded yes, according to the Bee.

The jurors were then asked to return after lunch for a potential second phase of the trial. The confusion over the verdict against Pearson came to light during lunch, when one juror came forward to tell court staff he had voted to find Pearson guilty, according to Linden Lindahl, an attorney for Minniweather.

Jurors said they were confused by the verdict forms, one of which was for a guilty verdict and the other for a not guilty verdict.

One juror said there was no form they could sign that indicated the jury was deadlocked.

Lindahl said he was surprised by the jury’s confusion since the judge “did everything by the book.”

“There was nothing out of the ordinary,” he said.

Court records show Minnieweather has two prior convictions for burglary and a conviction for unlawful possession of a firearm. He faces as much as 30 years to life when he is sentenced on July 10.

Pearson has felony convictions for corporal injury to a co-inhabitant, possession of a firearm by a felon, carrying a loaded firearm in a vehicle and carrying a concealed weapon, court records show.