A District-owned psychiatric hospital that was without potable water for nearly a month after a potentially harmful bacteria was detected in its water system has resumed normal use after tests showed the water is safe.

Shortly before the all-clear was announced Wednesday evening, patient advocates filed a federal lawsuit against the hospital and the city, saying conditions during the outage were “horrifying.”

St. Elizabeths Hospital in Southeast Washington had been without potable water since legionella bacteria, which can cause Legionnaires’ disease, was found during routine testing Sept. 26. The hospital, which never stopped admitting patients, began using bottled water for drinking and cooking, as well as wipes for bathing.

Officials said none of the hospital’s approximately 700 staff members and 270 patients became sick.

Crews treated the water system with chlorine earlier this month in an attempt to kill the bacteria, but last week said the initial attempt failed. After another chlorine flush, Barbara Bazron, director of the city’s Department of Behavioral Health, said Wednesday the water is safe. Workers were reinstalling about 800 faucet handles to resume normal water usage.

Bazron said the remediation — including money spent on portable showers, toilets and hot meals while the hospital’s kitchen was offline — cost more than $1 million. Officials are still trying to determine how the bacteria was able to enter the water system.

Bazron said a risk management plan is in place to help prevent the problem from recurring.

“It’s a good day,” she said Thursday. “The staff did, I thought, an outstanding job of managing the situation, and patient care continued throughout this process. . . . There was no break in the continuity of care.” She added: “There is no legionella in the water.”

On the same day water was restored, the American Civil Liberties Union of D.C. filed the class-action suit in U.S. District Court for the District of Columbia on behalf of four patients, alleging their care was compromised amid unsanitary conditions. The suit against hospital and city officials states the water outage exposed “vulnerable patients to irreparable harmful physical, emotional, and mental health consequences.”

According to the suit, patients weren’t able to participate in music or art therapy, and group therapy sessions were “diminished.” Patients also couldn’t access podiatry and dentistry services without running water, the suit alleged.

It went on to say the water was shut off several days before portable toilets were provided, and at one point staff members were “manually flushing the toilets only once or twice a day.” In some units, more than two dozen patients were sharing a toilet, according to the lawsuit.

“The toilets are overflowing and human waste is flowing onto the floors in some bathrooms,” the lawsuit said.

The suit seeks policy changes at St. Elizabeths, including an end to admissions during water outages and assessments of patients within 48 hours of an outage to determine if they could be better treated elsewhere.

Bazron said she had not seen the lawsuit and couldn’t comment.

Through an ACLU statement, patient William Dunbar said the “foul smell ‘makes me want to vomit.’ ” Dunbar, 30, gets a day pass to leave St. Elizabeths, and often tried to wait until he left the hospital before using the restroom.

The suit alleges that portable showers weren’t compliant with the Americans With Disabilities Act, had an unreliable water supply, and were sometimes cold, clogged and dirty. It said patients had to take turns using the showers, often standing to wait for others to finish in chilly weather.

The ACLU said in a statement that some patients were not allowed to shower but were given “body wipes or a bucket of soapy water and a washcloth.” The lead plaintiff in the case, 38-year-old patient Enzo Costa, said in the suit he refused to clean himself with wipes and a bucket, comparing it to “washing a dog or a car.” One patient said he suffered insect bites while using dirty toilets.

Some staff members missed work because of the water problem, and physical aggression increased among patients because of the stress, the suit alleged.

Andrea Procaccino, a staff lawyer at Disability Rights DC, which advocates for patients at St. Elizabeths, said she spent hours last week visiting patients and left distressed by what she saw.

Procaccino said patients, some unwilling to take showers because they used wheelchairs or suffered from mental illness, smelled of body odor and were “praying to get the water back on.”

“Being there for three hours got me all riled up,” she said. “A patient said to me: ‘You get to go home. You get to leave.’ ”

Margaret Hart, counsel at the Washington Lawyers’ Committee for Civil Rights and Urban Affairs, which worked with the ACLU on the suit, said it was “shameful” that the outage received little attention from D.C. leaders.

The groups involved in the lawsuit said they’re concerned legionella might return to the 164-year-old hospital, despite assurances from the city.

“There has not been a consistent, or effective, strategy for remediation of the water problem that will guarantee that this problem will not recur,” said John Freedman, a partner at Arnold & Porter, which filed the suit.

Kaitlin Banner, deputy legal director at the Washington Lawyers’ Committee, said St. Elizabeths patients are “some of the city’s most vulnerable.”

She called it “jaw-dropping” that the hospital continued to admit patients who needed serious mental health services and therapy but couldn’t get them because parts of the facility were closed.

D.C. Council member Vincent C. Gray (D-Ward 7) said the water contamination will be examined during a Nov. 20 oversight hearing on the Department of Behavioral Health. He said in a statement that officials would “question DBH leadership about the water management plan to ensure that contamination does not recur in the future.”

More than 6,000 cases of the pneumonialike Legionnaires’ disease were reported in the United States in 2016, according to the Centers for Disease Control and Prevention. The disease is fatal in about 10 percent of cases in which people get sick, the CDC said.