Richard Glossip, a former death row inmate in Oklahoma whose decades-long challenge to his conviction prompted the U.S. Supreme Court to stay his execution and grant him a new trial, was released from prison on Thursday for the first time in nearly 30 years.

Mr. Glossip was convicted in 1998 of arranging the murder of Barry Van Treese, his employer and the owner of a motel in Oklahoma City. Prosecutors argued that Mr. Glossip promised the motel handyman, Justin Sneed, $10,000 to kill Mr. Van Treese.

But two independent investigations found that critical evidence had been withheld and that the testimony of Mr. Sneed, the state’s star witness, was faulty, throwing Mr. Glossip’s guilt into question. The State of Oklahoma had set execution dates for Mr. Glossip nine times before the Supreme Court ordered a retrial last year.

“It’s overwhelming, but it’s amazing at the same time,” he told reporters on Thursday afternoon as he walked out of the jail with his wife.

Judge Natalie Mai of the District Court of Oklahoma County issued an order on Thursday setting Mr. Glossip’s bond at $500,000. He must wear an electronic monitoring device and cannot contact any witnesses in the case. He also submitted to a pretrial monitoring program and will not be able to travel outside Oklahoma.

Donald Knight, a lawyer for Mr. Glossip, said that the ruling was unexpected but that it provided a step forward in his client’s efforts to escape a “decades-long nightmare.”

“I suspect he’s going to be overwhelmed for quite some time,” Mr. Knight said in a phone interview. “You don’t almost get killed nine times by the state, or have three last meals — you don’t have that happen to you without it really, really scarring you.”

Mr. Glossip’s initial conviction was overturned in 2001 because of ineffective defense counsel. He was convicted again in 2004 and again sentenced to death.

In 2015, he was granted a stay of execution shortly before he was scheduled to be put to death after he and two other inmates argued that Oklahoma’s lethal injection protocol was unconstitutional. The Supreme Court then granted another stay in 2023.

During Mr. Glossip’s more than 20 years on death row, the Supreme Court has considered six petitions from him seeking review of his case and has granted two. The Oklahoma Court of Criminal Appeals upheld his conviction in 2023, despite the state’s insistence that sentencing Mr. Glossip to death would have been an unthinkable error.

State lawmakers in Oklahoma, as well as celebrities like Kim Kardashian, had called for Mr. Glossip to receive clemency or a new trial. Mr. Knight said a group of Mr. Glossip’s supporters had helped raise the money for his bond.

Attorney General Gentner Drummond of Oklahoma, a Republican, had also asked the Supreme Court to throw out Mr. Glossip’s 2004 conviction and order a retrial.

Mr. Drummond said last year that he would seek to retry Mr. Glossip on a murder charge but would not pursue the death penalty again.

Judge Mai wrote in her decision that the court expects the state to “rigorously prosecute” its case against Mr. Glossip, adding that “a new trial, free of error, will provide all interested parties, and the citizens of Oklahoma, the closure they deserve.”

In a statement, Mr. Knight expressed optimism for Mr. Glossip’s exoneration because Judge Mai’s decision had “rejected the state’s claim that there is a strong case for guilt.”

“We’ve always known that the state has a very weak case, and nothing could be more obvious from the court’s order today,” he said in an interview.