In a courtroom in Roanoke, a judge legally declared Bryan Manning a drunk in 2010.

Manning — who is homeless and difficult to track down — wasn’t even there that day. A judge and a prosecutor simply considered his list of alcohol-related offenses: drunk in public, profane language, failure to appear in court. It was a quick, civil proceeding that would have lasting criminal consequences.

In the eight years since, Manning has been prosecuted more than 30 times for something that is usually perfectly legal: possessing or drinking alcohol. In some cases, he says, just being near it was enough to get him arrested. He was picked up once in a Walmart that sold alcohol, he says, though he hadn’t purchased any. Another time, he was arrested for smelling like booze. Each time he was jailed, he lost the job he had at the time and usually all of his belongings, left behind at whatever public place he had been sleeping.

Manning’s legal troubles stem from a Virginia law that allows courts to label people “habitual drunkards,” often after they’ve committed multiple alcohol-related crimes. That decision happens at a civil hearing, where someone isn’t guaranteed an attorney to help fight the allegations. Once someone is legally branded a “drunkard,” it’s a misdemeanor crime to purchase, consume or possess alcohol — an offense that can earn them up to a year in jail.

Virginia advocates and public defenders have been fighting the law for years, saying it targets homeless people suffering from alcoholism and jails them without full due process. Manning is one of the lead plaintiffs in a class-action suit filed by the Legal Aid Justice Center in Virginia, claiming the statute is unconstitutional. But an August decision by the U.S. Court of Appeals for the 4th Circuit upheld the law.

“It just seems really ancient,” said Elaine Poon, the managing attorney at the Legal Aid Justice Center. “Alcohol is legal for all of us, except for these people who have been deemed undesirable by the district attorneys.” Poon notes that the law doesn’t specify what makes someone a drunkard or how many previous offenses they need to have committed.

Manning was well known to Roanoke police by the time he was labeled a “habitual drunkard.” In the year prior, he was arrested at least 10 times for being drunk in public, racking up hundreds of dollars in fines. His address was listed as “transient” or the city’s rescue mission shelter.

The Legal Aid Justice Center found Manning — as they did the other lead plaintiffs — through his public defenders. Although there is no data about how many of the “habitual drunkards” in Virginia are homeless, public defenders say they were seeing such cases pop up repeatedly on their caseload.

“There’s a group of individuals we see very, very regularly. They’re the frequent fliers,” said Geoffrey Tucker, a Richmond public defender. “It seems like a way of managing people that [the city] would rather not deal with, by putting them in jail instead of in treatment.”

Tucker is appealing a client’s “habitual drunkard” status to the Virginia Supreme Court. Sometimes, clients don’t know they have been labeled as such until their first arrest for drinking. And even if the charges are ultimately dropped, many will not be released on bail while awaiting a hearing.

The statute has been used against a relatively small number of people. According to the complaint, 1,220 Virginians were “interdicted” between 2007 and 2015, the legal process that can label someone a “habitual drunkard.” And from 2005 to 2015, interdicted individuals were convicted nearly 5,000 times for drinking or possessing alcohol. Whether the law is enforced varies from city to city: Fewer than half of Virginia’s prosecutor’s offices have used it since 2007. Prosecutors in Virginia Beach have interdicted the most people, according to statistics compiled by the Legal Aid Justice Center.

Prosecutors say the law is a way for them to try to control people who pose persistent threats to public safety and prompt myriad complaints from the community.

The commonwealth’s attorney’s office in Richmond has interdicted nine people since 2007. It, along with the Roanoke office, is a named defendant in the suit, though the complaint was filed against all commonwealth’s attorneys. Deputy Commonwealth’s Attorney Colette Wallace McEachin, who oversees the office’s interdiction orders, says her office uses the law sparingly to compel people to get help.

“We don’t interdict many people. It takes a lot. It really has to rise to a level where it’s not just a nuisance, [but] where we are concerned about the community’s safety or this person’s safety,” she said. McEachin finds that once someone has been labeled a “drunkard,” the possibility of a year in jail is more leverage to get them into rehabilitation than the fine for public intoxication would be. “There are at least three or four cases I know of where once a person’s been interdicted, we were able to convince them to go to treatment.”

The Virginia Attorney General’s Office also defends the law. In a brief submitted in the case, it wrote that the law serves the state’s “legitimate interests in curbing alcohol abuse and in the welfare and safety of Virginians,” and that the plaintiffs have failed to prove that the law discriminates against the homeless. Being labeled a habitual drunkard in and of itself doesn’t lead to imprisonment, the office argues, and the state has the right to regulate alcohol.

But the statute remains an outlier. Utah is the only other state with something similar on the books.

Plaintiffs in the case say they’ve been arrested on just the suspicion that they’ve been drinking. Ryan Williams, who has spent 15 years on the streets of Roanoke, was sleeping in a park bathroom when police found a beer can in the trash. According to Williams, they said it was his and sent him to jail. Two others claimed in the lawsuit that they also had been arrested over empty beer cans found nearby.

In a concurring opinion, appeals court Judge Diana Gribbon Motz wrote that legal precedent required her to uphold the statute, but that she agreed it criminalized addiction. “Because thousands of Virginians remain subject to a law that, in my view, is unconstitutional, I [concur] with reluctance and regret,” she wrote.

The plaintiffs are petitioning to have it reconsidered by the full 4th Circuit, in hopes of overturning the long-standing law.

One public defender, who is now a state delegate, Jennifer Carroll Foy (D-Prince William), will introduce a bill in the next General Assembly session that would repeal the law entirely. Foy introduced a similar bill in January, but it died in committee. Many of her fellow legislators didn’t know the law existed, she said, or didn’t believe it was still being enforced.

“A lot of people don’t think about the collateral consequences of throwing someone in jail. If they were on a waiting list for housing, now they’re off. If they were on disability, oftentimes, it’s cut off. If they had a job, now they’ve lost it,” Foy said. “You can’t incarcerate yourself out of addiction.”

Christie Thompson is a reporter for the Marshall Project, a nonpartisan, nonprofit news organization that writes about the U.S. criminal justice system.