An Alabama man who spent more than three decades in jail for a $50 robbery will be released after a judge altered the life sentence on Wednesday, according to reports.

The man, Alvin Kennard, was 22 when he was sentenced to life without parole in the 1980s. He is now 58, and had served 36 years in the William E. Donaldson Correctional Facility in Bessemer, Ala., a local CBS affiliate reported.

Circuit Judge David Carpenter re-sentenced Kennard on Wednesday and he will be released from prison, the outlet reports.

Kennard was convicted of first-degree robbery for the January 1983 robbery of a bakery in Bessemer. He was sentenced to life under Alabama’s Habitual Felony Offender Act, following other charges he received at 18, AL.com reported.

I just witnessed the most extraordinary moment. Judge David Carpenter in Bessemer, AL has resentenced Alvin Kennard to time served after he got life without parole for robbing a bakery of $50 in 1983. He is now 58 & was 22 when he committed the robbery. pic.twitter.com/CYeWsnHmVG — Beth Shelburne (@bshelburne) August 28, 2019

Kennard reportedly thanked the judge after his resentencing.

“I’m sorry for what I did ... I was wrong,” Kennard said, according to AL.com’s report. He also said he would live with his family in Bessemer and work in carpentry.

Kennard was represented by Carla Crowder, executive director of the Alabama Appleseed Center for Law and Justice. ADVERTISEMENT

Crowder argued that under Alabama’s current sentencing guidelines Kennard would have received a maximum of about 20 years, CBS 42 reported.

Kennard must still be processed by the Alabama Department of Corrections, and Crowder told CBS 42 she does not know when he will be released.