Oklahoma dismissed a murder charge against Richard Glossip on Thursday, and he pleaded guilty to a lesser charge of being an accessory to murder after the fact, his lawyer said. Glossip spent nearly 30 years in prison and was sentenced to death in the 1997 killing of his former boss, motel owner Barry Van Treese, who was beaten with a baseball bat. Prosecutors have said the killing was a murder-for-hire plot. Glossip has long said he is innocent.

The US Supreme Court threw out his conviction last year after finding that prosecutors used testimony they knew to be false, violating his right to a fair trial, NBC News reports. He was released on bond in May to await a new trial. Attorney General Gentner Drummond had said he intended to retry Glossip on a first-degree murder charge, but without seeking the death penalty. Drummond also agreed that Glossip did not receive a fair trial, calling that "an undeniable fact," NBC News reports.

Glossip pleaded guilty to the accessory charge "to put this matter to rest," according to his attorney, Don Knight. Sentencing will be in December, Knight said. Knight said Glossip would have been released a decade ago if prosecutors had originally convicted him of the accessory charge. "We look forward to an opportunity to show why returning him to custody would not serve the interests of justice, and to ending this nightmare for Rich and all concerned," Knight said, according to NBC News.

Prosecutors intend to seek a maximum 45-year sentence, according to Drummond's office, NBC News reports. Drummond said it was a difficult decision, but that "this path ensures a conviction related to Mr. Van Treese's murder and gives us the best chance to secure additional prison time for Glossip." Since his 1998 conviction, Glossip has had nine execution dates set, NBC News says. At least three times he was served what was expected to be his last meal. The Associated Press, in a report carried by ABC News, says he was on the brink of execution three times. The AP report also notes that his claims of innocence have drawn support from Kim Kardashian and other public figures.

What we know: Oklahoma dismissed the murder charge, Glossip pleaded guilty to being an accessory after the fact, and sentencing is set for December. What we don't know: What sentence the court will impose, and whether he will be returned to custody.