RICHMOND, Va. (AP) — The American Civil Liberties Union of Virginia has filed a legal challenge to a last-minute amendment to the state budget that blocked the planned early release of hundreds of inmates this summer.

The change affected the state’s earned sentence credit program, which was expanded in 2020 to allow inmates to shave more time off their sentences for good behavior. The budget amendment reined in who can qualify for the expanded credits.

The ACLU claims in a lawsuit filed Monday on behalf of inmate Antoine Anderson that state prison officials wrongly interpreted the amendment. The petition demands that Anderson be released immediately.

Anderson, now 45, has spent the past 18 years in prison on federal drug charges, as well as charges of attempted escape, abduction and two counts of assault on a corrections officer during what he described as a riot at the Albemarle-Charlottesville jail, where he was being held in 2004, said Geri Greenspan, a staff attorney for the ACLU.

In March, Anderson was told by prison officials that he had earned enough good behavior time under the 2020 expanded credits law to be released in July. But less than two weeks before he was expecting to get out, he was told that the recent budget amendment proposed by Gov. Glenn Youngkin and approved by the General Assembly made him ineligible for the early release date. Now, Anderson is expected to remain in prison until April 2024.

The budget amendment excluded Anderson and more than 500 other inmates with violent offenses from receiving the expanded credits, meaning they would have to serve more time and would not be released in July and August, as they expected.

In its petition, the ACLU said Anderson fell into a depression after learning he would have to serve an additional 22 months in prison.

“When we were told we were not going home, it broke down our mental state. It made us feel like we were never going to leave. We served our time, and we deserve to have a second chance. We are not the same people we were when we entered prison,” Anderson said in a statement released by the ACLU.

Anderson’s 18-year-old daughter, Niya, was born after her father went to prison and has never known him outside prison walls. She said she and her father were crushed because he planned to bring her to Delaware State University soon for her to start college.

“Why would you grant freedom to somebody and then take it away — like it’s not a life we’re talking about?” she said. “This is somebody’s freedom.”

During the legislative debate, Republicans, who were joined by a few Senate Democrats in approving the amendment, argued that offenders who were convicted of violent crimes shouldn’t get a shot at reducing their time behind bars.

The 2020 law, passed when Democrats were in full control of state government, created a system that allowed inmates with good behavior and participation in rehabilitation programs to earn expanded credits for up to 15 days per month to be taken off their sentences for nonviolent offenses. Before the law was approved, inmates could earn up to 4.5 days per month.

The law had a delayed effective date of July 1, 2022, so prison officials would have time to calculate new release dates.

Under the 2020 law, violent offenses were not eligible for the expanded credit. But if inmates had a combined sentence with both a violent conviction and a lower-tier one, they could potentially shave some time off the sentence they were given for the nonviolent offense.

Multiple attempts to repeal the law failed, but the last-minute budget amendment from Youngkin was approved by the General Assembly in June.

In its legal challenge, the ACLU said state prison officials have misinterpreted the budget amendment to apply retroactively, thereby negating the credits Anderson and others like him had earned before July 1, 2022, when the budget went into effect.

“Under just principles of statutory interpretation, the only way to interpret the meaning of the statute is to say the budget amendment applies only to time served between July 1, 2022, and June 30, 2024,” said Greenspan, referring to the two-year period covered by the budget.

The ACLU said Anderson has taken steps to rehabilitate himself, including completing drug treatment programs, anger management classes, parenting classes and commercial driver training.

A spokesman for the Department of Corrections declined to comment on the lawsuit. Youngkin’s office referred a request for comment to the office of Attorney General Jason Miyares. His spokesperson declined comment, saying the office had not received the lawsuit.