The prosecutor called him a “coward” and said the death penalty wasn’t punishment enough for the crime he committed.

But yesterday – after 22 years behind bars and eight weeks of wearing an ankle bracelet – Byron Halsey walked out of an Elizabeth, N.J., courtroom a free man.

On May 15, Halsey’s conviction was thrown out after new DNA tests cleared him of the gruesome murder and rape of his girlfriend’s two children in 1985.

The new tests, not available at the time, pointed to Clifton Hall, 49, a next-door neighbor and the star prosecution witness.

Hall has now been charged in the heinous crime, in which nails were pounded into the brain of one of the children.

Although the conviction was overturned, Halsey, 46, had to wear an ankle bracelet while the Union County prosecutor’s office decided whether to retry him.

Yesterday, assistant prosecutor Albert Cernadas went before Union County Superior Court Judge Stuart Peim to ask that all charges be dismissed.

“The only evidence against Byron Halsey is his uncorroborated confession, key portions of which have been refuted by the DNA evidence,” Cernadas said.

“The state cannot meet its burden of proof.”

With that, Peim dismissed the charges and told Halsey, “I wish you the best of luck.”

Halsey, wearing a green-gray suit, pale yellow shirt and gold tie, hugged his lawyers, Barry Scheck of the Innocence Project and Raymond Brown of Newark. “Thank you, your honor,” he told the judge. “Can I have your autograph, please?”

The courtroom erupted in laughter.

“I want to thank everyone for their prayers,” Halsey said outside court.

“This is the first time I’ve been free in 22 years – plus I got that little dude off my leg,” he said, referring to the ankle bracelet.

He thanked prosecutors for “acknowledging the truth,” his grandmother, whose birthday was yesterday, and God.

“I thank my Lord, my savior, for carrying me through the years,” he said

Asked what was the biggest change since he went to prison in 1985, he held up his cellphone and said, “Cellphones, man.”

“My niece and nephew had to show me how to work the TV and the cable,” he added.