A man blamed for infecting eight people since discovering he was HIV-positive was ordered by a Seattle judge to get treatment for the infection and attend counseling sessions.

It the man, identified only as “AO” in court documents for privacy reasons, fails to do so, he can be involuntarily hospitalized or jailed for contempt of court, the Seattle Post-Intelligencer reported.

Seattle’s public health department had twice issued cease-and-desist orders requiring the man to undergo treatment and counseling, but he failed to show up for appointments. In a closed hearing on Friday, Superior Court Judge Julie Spector told the man he had to comply.

A spokesman said the department has to issue such orders for HIV-positive people, less the once per year on average. This is only the second time they’ve ever had to ask the court to enforce an order.

“We’re not trying to criminalize sexual behavior here,” Matthew Golden, director of the department’s HIV/STD control program told the Seattle Times. “We are trying to protect the public’s health. And we’re trying to make sure that everyone gets the care they need, including the person involved in this.”

He said the department doesn’t get involved in cases where consenting adults knowingly take risks. “That is a decision you’re entitled to make in this society,” he said. “Public health doesn’t get involved in that.”

But, he added: “This is not an instance where two knowledgeable consenting adults took a risk,” suggesting the man did not disclose his HIV-positive status to his partners.

When the man was diagnosed in 2008, he was advised to disclose his HIV-positive status to sexual partners and instructed on safe-sex practices. He received HIV counseling on five occasions after the initial diagnosis. However, eight people newly infected with HIV since 2010 named the man as a sexual partner according to court documents.

It can be difficult to pin down the source of an HIV infection because people may have multiple sex partners. Blood tests can be done to compare the DNA of the virus in one person to the DNA of the virus in another person, but even that is not conclusive.

But health officials don’t need that sort of proof to act. Under a 1988 state lawthey need “direct medical knowledge or reliable testimony” that an HIV-positive person is behaving in a way endangers public health. Federal and state laws similarly allow public health officials to intervene to stop the spread of tuberculosis and other communicable, life-threatening diseases.

The health risks of having unprotected sex when you have HIV are obvious – the deadly virus is transmitted through bodily fluids, including semen.

The law says legal action “shall be used as the last resort when other measures to protect the public health have failed.” The first step is counseling, but if an HIV-positive person is repeatedly listed as a sex partner by people newly diagnosed with HIV, the department can seek a cease-and-desist order. The order in this case requires the man to go to the doctor, but that doesn’t mean he has to swallow the pills, Golden conceded.