An Alabama man who spent 36 years behind bars for stealing $50.75 from a bakery will soon be a free man — and apologized to a judge this week for his crime, according to a new report.

“I’m sorry for what I did,” Alvin Kennard told Jefferson County Bessemer Cutoff Circuit Judge David Carpenter on Wednesday. “I was wrong.”

Kennard, now 58, was convicted of first-degree robbery in connection with the January 1983 theft at Highlands Bakery and sentenced to life without the possibility of parole, under Alabama’s Habitual Felony Offender Act, AL.com reported.

Four years earlier, he was charged with burglary, grand larceny and receiving stolen property in connection with a break-in at an unoccupied service station, according to the report.

For that incident, he pleaded guilty to three counts of second-degree burglary, and was handed a suspended sentence of three years’ probation, the paper reported.

Because of those prior offenses — which were not Class A felonies — Kennard was sentenced under the Habitual Felony Offender Act in 1984.

At the end of a Wednesday hearing, the judge determined that Kennard had served his time, the paper reported.

Kennard said that if released, he’d live with family in Bessemer and do carpentry work.

Bessemer’s release won’t be immediate — he’ll have to be processed out by the Alabama Department of Corrections, and it’s not clear how long that will take, according to the report.

When the judge asked who would support Kennard upon his release, more than a dozen loved ones rose from their seats, chanting, “Thank you, Jesus.”

County prosecutors didn’t oppose the judge’s decision, according to the paper.

“But let me be clear, this is not about $50,” Assistant District Attorney Lane Tolbert said.

Back in 2013, Alabama launched a state sentencing commission that laid down sentence guidelines.

If Kennard had been sentenced for first-degree robbery today, his minimum sentence would be 10 years, and the maximum would be life with the possibility of parole, according to the report.