JONESBORO, Ark. – Three men convicted in the nightmarish slayings of three Cub Scouts went free Friday, nearly two decades after they were sent to prison in a case so gruesome it raised suspicions the children had been sacrificed in a Satanic ritual.

Doubts about the evidence against the trio had persisted for years and threatened to force prosecutors to put on a second trial in 2012.

Instead, the so-called West Memphis Three were permitted to plead guilty to murder in exchange for time served, ending a long-running legal battle that had raised questions about DNA and key witnesses — and attracted support from celebrities such as singers Eddie Vedder of Pearl Jam and Natalie Maines of the Dixie Chicks.

The men entered the pleas under a legal provision that allowed them to maintain their innocence while acknowledging that prosecutors had enough evidence to convict them.

“Although I am innocent, this plea is in my best interest,” Jessie Misskelley said.

Damien Echols had been on Arkansas’ death row and in 1994 came within three weeks of execution. He remained defiant Friday, accusing prosecutors of using innuendo and faulty evidence to convict them.

In the event of a new trial, “they knew there would be more people watching, more attention on the case, so they wouldn’t be able to pull the same tricks,” Echols said.

Scott Ellington, the prosecuting attorney in Jonesboro, Ark., said that with new revelations in the case, it was likely the men would have received new trials — and that it would have been “practically impossible” to put on a proper trial 18 years after the slayings.

The mother of a witness who testified about Echols’ confession has publicly questioned her daughter’s truthfulness. And a crime lab employee who collected fiber evidence at two of the defendants’ homes has died.

“I believe this case is closed, and there are no other individuals involved,” Ellington said.

Since the original jury convictions, two of the victims’ families have joined forces with the defense, declaring that the men are innocent, he added.

The victims’ families were notified about the pact ahead of time but were not asked to approve it.

Echols said he and the others would keep working to clear their names. The men have spent half their lives in prison.

Asked by reporters about his plans, Jason Baldwin replied, “Live my life the best I can and enjoy every moment of it.”

Baldwin told reporters he had been reluctant to plead guilty to crimes he didn’t commit, but he agreed to do so to ensure Echols was spared from death row.

Echols thanked Baldwin and called his release “overwhelming.”

“It’s not perfect by any means,” he said of the arrangement. “But it at least brings closure to some areas and some aspects.”

The prosecutor said he never considered any plea bargain that would throw out the verdicts of two juries.

“Today’s proceeding allows the defendants the freedom of speech to say they are innocent, but the fact is, they just pled guilty,” Ellington said.

By entering guilty pleas, the three have lost any right to sue the state.

“I can’t say that wasn’t part of my thinking in resolving this case,” Ellington said.

In the courtroom, the father of one of the victims spoke out shortly after the men entered their pleas.

“Your honor, if you go through with this, you’re going to open Pandora’s box,” Steve Branch protested before deputies led him away. “You’re wrong, your honor. You can stop this right now before you do it.”

All three men were placed on 10 years’ unsupervised probation. If they get in trouble again, they could be sent back to prison for 21 years, Ellington said.

Circuit Judge David Laser acknowledged the case was complex and that families on both sides had suffered. He said Friday’s deal would serve justice “the best we can.”

“I don’t think it will make the pain go away,” Laser said.

One person yelled, “Baby killers” as the three left the courtroom.

The killings were particularly ghastly. The 8-year-old boys — Steve Branch, Christopher Byers and Michael Moore — were found naked and hogtied, and rumors of Satanism roiled the community of 30,000 people across the Mississippi River from Memphis, Tenn.

Branch and Moore drowned in a drainage ditch in about 2 feet of water; Byers bled to death, and his genitals were mutilated and partially removed.

Police had few leads until receiving a tip that Echols had been seen covered in mud on the night of the boys’ disappearance. The big break came when Misskelley unexpectedly confessed and implicated the other two.

Misskelley told them he watched as Baldwin, then 16, and Echols, then 19, killed the boys. One detective said Misskelley had also talked about being in a cult.

Misskelley, then 17, later recanted, and defense lawyers said he got several parts of the story incorrect. Supporters have noted that he’s mentally disabled.

An autopsy found there was no definite evidence of sexual assault. Miskelley had said the older boys abducted the Scouts in the morning, when they had actually been in school all day.

Misskelley was tried separately and sentenced to life in prison plus 40 years. He refused to testify against the others, and his confession was not used as evidence. Baldwin got life without parole.

The three were convicted in 1994, but have been behind bars since their arrests shortly after the killings, ultimately serving 17 years of their original sentence.

A 1996 HBO documentary titled “Paradise Lost: The Child Murders at Robin Hood Hills” drew the attention of celebrities including Vedder and Maines. Joined by other stars, they helped fund a legal team that sought a new trial.

“Why are they innocent?” Vedder told The Associated Press last year. “Because there’s nothing that says they’re guilty.”