An Alabama man who has spent almost 36 years in prison after stealing $50 was released Friday under new sentencing guidelines that reset the state's three-strikes law.

Alvin Kennard, 58, had been serving a life sentence without the possibility of parole.

But his sentence was changed to time served by Judge David Carpenter in Jefferson County on Wednesday. The state's Department of Corrections had to process Kennard out of the system, which is why he wasn't immediately released after the ruling. He was released from the William E. Donaldson Correctional Facility, just outside of Bessemer, Alabama on Friday, the Alabama Department of Corrections said in a statement.

Alvin Kennard sits in the courtroom before his hearing in Bessemer, Ala. on Aug. 28, 2019. Kennard, sentenced to life in prison in 1983, for stealing $50.75 will have his time cut short after being resentenced to time served. Ivana Hrynkiw / AP

"We've just been praying and trusting in God that this day would come and it's here, and we're so grateful to God," Kennard's niece Patricia Jones told NBC affiliate WVTM.

Kennard was convicted of robbing a bakery Jan. 24, 1983, in a felony that netted him $50.75, the Birmingham News reported, citing court records.

That bakery crime came after Kennard had previously broken into a vacant service station, leading him to plead guilty to three felony counts of burglary and larceny in 1979. Due to that previous conviction, he was sentenced to life behind bars under the three-strikes provision of Alabama's Habitual Felony Offender Act.

But in 2013, the Alabama Sentencing Commission adopted new guidelines which, if they had been in place when Kennard robbed the bakery, would have made his previous crime not serious enough to trigger a life sentence without parole, defense lawyers said.

Had these new standards been in place then, Kennard couldn't have been imprisoned for any more than 20 years, his attorney Carla Crowder said. He could have been eligible for parole after 10 years.

Kennard told the judge Wednesday that he is still remorseful for his crimes.

“I’m sorry for what I did," Kennard, dressed in orange-and-white jail garb, said. "I was wrong."

The district attorney's office did not oppose the change in his sentence. Prosecutor Lane Tolbert said, however, that his office did not err in applying the law.

“But let me be clear, this is not about $50," Tolbert said.

Kennard has said that after his release, he plans to live with family in Bessemer and work in carpentry.