A Virginia man who was convicted of attempted aggravated murder will be released from prison under a state Supreme Court ruling Thursday that found the man had been wrongfully denied earned sentence credits.

The ACLU of Virginia sued the Department of Corrections to demand the immediate release of Steven Prease, arguing that the department had improperly interpreted the language of a law that expanded the state's earned sentence credit program.

Since 1995, the earned sentence credit program has allowed many inmates to earn early release for good behavior. In 2020, state lawmakers amended the law to increase how many credits inmates could earn.

Prease, a military veteran who the ACLU said suffers from post-traumatic stress disorder, was convicted in 2013 of two counts of attempted aggravated murder and other charges for firing a gun at sheriff's deputies after a domestic dispute. In March 2022, prison officials told Prease he would be released between July 1 and Aug. 30, 2022, based on the retroactive application of expanded credits under the law.

RIP CURRENTS PROMPT RESCUES OF 200 SWIMMERS IN VIRGINIA AND NORTH CAROLINA

But a month later, newly elected Attorney General Jason Miyares disagreed with an interpretation of the law by former Attorney General Mark Herring. Miyares found that attempted aggravated murder and conspiracy to commit aggravated murder were ineligible for expanded credits.

After Miyares issued his opinion, the Department of Corrections extended Prease's release date by about two years, to June 4, 2024.

Virginia Supreme Court

Virginia's Supreme Court building is pictured on Jan. 15, 2021, in Richmond. The state's Supreme Court has ordered the release of Steven Prease, a man who was convicted of aggravated murder, after it was found that he was wrongfully denied earned sentence credits. (Photo by Eze Amos/Getty Images)

In its ruling Thursday, the state Supreme Court said the law clearly spells out which offenses are ineligible for the additional earned sentence credits, and the list does not include aggravated attempted murder.

"Thus, it would appear that there is no basis in the governing statutes for denying Prease expanded earned sentence credits on his attempted aggravated murder convictions," the court said in its ruling.

FAMILY SEEKS INVESTIGATION AFTER VIRGINIA MAN DIES OF ASPHYXIATION AT PSYCHIATRIC HOSPITAL

The Department of Corrections did not immediately respond to a request for comment on the ruling.

ACLU of Virginia Senior Supervising Attorney Vishal Agraharkar said he expects Prease to be released from prison soon under the ruling. Agraharkar said he is unsure how many other inmates could be released early because of the decision. But he said hundreds, if not thousands, were told by prison officials that they had earned an earlier release but were later told that they did not qualify for the expanded credits because of an incorrect interpretation of the law that has now been rejected by the Supreme Court.

CLICK HERE TO GET THE FOX NEWS APP

"We are hoping that the department will do the right thing and ensure that the benefit of the earned sentence credits law applies to everyone who is eligible under the statute," Agraharkar said.

Thousands of other inmates were denied eligibility for the expanded credits after state lawmakers approved a budget amendment from Republican Gov. Glenn Youngkin that excluded inmates with violent offenses.