After two years of freedom, a Montana man is back in custody after a state Supreme Court ruling that could send him back to prison for the rest of his life for the 1979 slaying of a teenager

A spokesman for the attorney general said Barry Beach was taken into custody without incident Wednesday morning by the Yellowstone County Sheriff's Office.

"It was hard enough to be innocent to begin with," Beach said. "But to going back still innocent for the second time is just unbelievable."

Beach, 51, was convicted of killing Kim Nees after she resisted his advances late one summer. He spent almost three decades in prison before a Lewistown judge determined in 2011 that new evidence raised doubts about Beach's guilt in the murder of a 17-year-old classmate on the Fort Peck Indian Reservation.

A long list of influential advocates persistently argued over the years that Beach had been wrongly convicted based on a coerced confession, and said evidence instead pointed to an out-of-control fight among teenage girls.

But the state Supreme Court's 4-3 ruling upheld the original 1984 conviction. Justices said Beach provided details only the killer would know in a 1983 confession given to Louisiana police who had picked him up on an unrelated crime.

Beach had spent part of his last hours of freedom eating breakfast at a diner with the mayor of Billings and other friends. Wearing a T-shirt that says "I didn't do it," he told The Associated Press it was unbelievable he could return to prison nearly two years after a Lewistown judge freed him.

Beach had said prior to being taken into custody that he still had not had a chance to read the 89-page ruling that restored his original murder sentence of 100 years in prison with no possibility of parole.

Billings Mayor Tom Hanel, who befriended Beach through Ziegler, said Tuesday's ruling denied Beach the chance he deserved to prove his innocence.

"It's a question of whether justice has really been served and if a fair opportunity has been provided," Hanel said.