One of the more bizarre moments at Sunday’s ultra-bizarre Oscars ceremony centered on one of the unsuspecting tour bus riders, “Gary from Chicago,” used by host Jimmy Kimmel in an elaborate gag bit.

Now court records show that the man, Gary A. Coe, was recently released from a California prison, where his public defender claims he spent the past 20 years.

According to a source at Kimmel’s “Jimmy Kimmel Live!” weeknight talk show, the original plan to have both Coe and his fiancée as guests on the Monday episode were axed after producers got wind of Coe’s criminal record and “became very nervous regarding a number of unanswered issues that possibly could have led to yet another embarrassing Oscar-related situation.”

“It just didn’t seem worth it to take the chance,” the source added.

In the wake of Coe’s appearance on the Oscars, Coe’s public defender, attorney Karen Nash, posted on her Facebook page that Coe received a life sentence for “stealing perfume.”

She also wrote on the social-media website, “I spent this afternoon laughing and crying with Gary and [his fiancée] Vicky. For those of you who missed it — I spent years working on Gary’s case. He got a life sentence for stealing perfume in 1997, and we finally won release this year.

“He got out on Friday, and was sightseeing with his lovely fiancée Vicky. If you watched the Oscars, you know the rest.”

Jimmy Kimmel: ‘We could make America great again’
Roeper on Oscars: Let’s put Viola Davis’ speech in perspective
Oscar Fashions: Who’s wearing what, and ribbons make a statement

Coe, 59, went to prison in October 1994 for “grand theft exceeding $400,” according to Vicky Waters, a spokeswoman with the California Department of Corrections and Rehabilitation. Coe was paroled about two years later but then picked up a petty theft conviction, which, under the state’s get-tough “Three Strikes” law, earned him 25 years to life, Waters said.

But earlier this year, Coe benefited from California’s Proposition 36, which allows some third-strike offenders to petition the court for leniency. Coe then had his sentence reduced to six years.

“Per pre-sentencing credits, and time-served, he was fully discharged on 2/23/17 [Thursday] upon completing his term,” Waters said.

Attempts to reach Coe have been unsuccessful. On Monday night, he said in a phone interview with ABC-Channel 7 that he was a South Shore native, hence his shoutout to the Windy City when Kimmel greeted him at the Dolby Theatre.

“I’m a Chicago boy!” Coe said. “That’s the Windy City! That’s my town!”

The set-up for the Kimmel Oscar bit was to surprise a small busload of random Hollywood tourists by bringing them into the massive complex that includes the Dolby Theatre — the site of the live Academy Awards presentation. The tourists were told they had been chosen to preview an exhibit of movie star costumes and gowns, but instead were ushered right into the front of the Oscar show.

Coe and his fiancee quickly became the star attraction of the gag — with Kimmel orchestrating a faux “wedding ceremony” conducted by Oscar winner Denzel Washington, once he learned the two were engaged to be married this summer.

Coe told Channel 7 that his time in prison made him a changed man.

“Change is possible,” he said. “It’s a sad day to be in prison for 20 years and not be able to be a dad, granddad to your children. You know what my son told me today, man, and I almost come to tears. He said he’s proud of me. So to hear your children say that they’re proud of me means the world to me.”