A Montana man who has spent nearly 29 years behind bars was released from prison Wednesday pending a new murder trial, in a case that has been closely watched across the state.

District Judge E. Wayne Phillips ordered Barry Beach, 49, released on his own recognizance at a hearing in Lewistown.

The decision came just weeks after Phillips ordered a new trial for Beach, who was convicted in the 1979 beating death of a 17-year-old girl in a small town on the Fort Peck Indian Reservation.

After Wednesday's hearing, Beach changed from a suit and tie into a Washington Redskins football jersey with the number 28. He said the number was symbolic, citing the 28 years and 11 months he spent in jail and prison.

"This picture is proof that the United States of America still believes in right and wrong, and when there's a wrong, you correct it," said Beach, pointing to supporters.

The case has made headlines across Montana for years, with Beach proclaiming his innocence and gaining a long list of backers, including New Jersey innocence group Centurion Ministries.

But many others, including the current chief justice of the Montana Supreme Court, maintain Beach indeed bludgeoned schoolmate Kim Nees to death on a summer night more than three decades ago.

In 2007, the case was thrust into the spotlight as a state parole board agreed to review evidence from Beach backers pointing to a gang of girls as the real killers.

The Montana Board of Pardons and Parole took the unusual step of taking testimony from the original prosecutors, investigators, the witnesses brought by Beach to support his claims, and Beach himself.

But the board ultimately was not convinced, and rejected either commutation of Beach's sentence or an executive pardon.

In ordering a new trial, Phillips said there was enough evidence to raise doubts about Beach's guilt after a court hearing last summer in which witnesses linked Nees' death to an out-of-control fight among teenage girls.

The state plans to appeal the order for a new trial to the state Supreme Court. On Wednesday, the state argued for bail to be set at $250,000 after the judge turned down its motion to stay the hearing pending its appeal.

But Phillips determined Beach has already served more time than most people found guilty of similar crimes.

Beach was convicted of deliberate homicide in 1984 and sentenced to 100 years in prison. He entered the Montana State Prison on Dec. 7, 1985 — exactly 26 years before his release Wednesday.

Beach has maintained for years that his 1983 confession to Louisiana police about the killing was coerced and that there is no evidence linking him to the crime.

In that confession, Beach said he tried to kiss Nees and became angry when she fought back. He described hitting her with a wrench and a tire iron, then thinking "Oh my God, what have I done?" after checking her pulse and finding she was dead.