Ellen Segal Huvelle, U.S District Court for the District of Columbia, at her chamber in Washington, D.C., in June 2015. (ASTRID RIECKEN/For The Washington Post)

A federal judge Tuesday ended 40 years of court supervision of the District’s care for people with intellectual and developmental disabilities, concluding what city leaders called the longest-standing U.S. class-action lawsuit of its kind.

U.S. District Judge Ellen S. Huvelle’s order ended a legal odyssey for 479 surviving class members and a larger group of thousands of the city’s most vulnerable residents, many of whom over the years experienced abuse, neglect or whitewashed death investigations after they died while wards of the city.

The lawsuit led to an infusion of more than $2.3 billion in federal aid, the return of $1.2 million in class members’ stolen or misappropriated disability payments, and the eventual bureaucratic transformation of a “broken” system into one of the most modern in the country for treating people with mental disabilities, moving from 49th in 2007 to eighth in 2015 in a national ranking by United Cerebral Palsy.

“This is a case that has spanned eight mayoral administrations, three federal judges and countless administrators of District agencies,” said Clarence J. Sundram, a court-appointed special master in the case and an adviser to New York Gov. Andrew M. Cuomo (D). “It’s a historic accomplishment.”

While advocates remain anxious about the city’s future course, Mayor Muriel E. Bowser (D), her predecessor and now-D.C. Council member Vincent C. Gray Jr. (D) were among nearly 100 attorneys, city employees, advocates and six class members present in court to recognize the protracted progress since the District’s 1991 closing of Forest Haven, the notorious asylum then run by the city, in Laurel.

Lynn Snyder (standing, left), a plaintiff in a 40-year class-action lawsuit that led to the closure of the District’s Forest Haven Asylum , and co-lead plaintiffs' attorney Sandra J. Bernstein, present a blanket made by Snyder in thanks to U.S. District Judge Ellen S. Huvelle seated in background) at the end of a hearing Jan. 10. The hearing formally concluded court supervision of the city's operation of programs for people with intellectual disabilities. Huvelle presided over the case since 2001. Also pictured seated at left, court reporter Lisa Griffiths. (Courtesy Clarence J. Sundram, special master and court monitor, U.S. District Court of the District)

“Although plaintiffs are understandably reluctant to end Court supervision given the long, and sometimes tortuous, history of this litigation, the Court believes that that time has come,” Huvelle said.

As recently as 2007, Huvelle acknowledged ongoing “systemic” and “fundamental” failures of city operations while the federal government and private watchdog groups renewed calls to find District officials in contempt and put the program into receivership.

Huvelle declined to do that but, by 2010, named an independent court administrator to improve District funding, quality control and licensing procedures. Last month, the judge cited “steady and substantial” progress and found the District had “finally achieved compliance” in all areas.

Bowser did not speak in court but afterward pledged that the city this time would keep its promises. “We’ve achieved the milestones that the court set out, but also we continue our commitment to maintain those investments, leadership at the Department [of Disability Services] and improved services for our residents,” Bowser said.

Gray, who led efforts to close Forest Haven and then compiled a mixed record as head of the city’s Department of Human Services starting in 1991, said, “I’m really proud of being part of something this important.” He added: “We still have lots of work to do to create a different way of life in the system.”

The victory was built on a mountain of failures. The lawsuit was brought by six individuals in 1976 and named for lead plaintiff Joy Evans, who was committed at 8 and died in Forest Haven in 1976 at 17.

Plaintiffs in a class that eventually numbered more than 3,000 men, women and children — most of them low-income African Americans without family or other support — documented the human toll of bureaucratic failure, describing a warehouse of physical and psychological neglect and mistreatment, substandard or nonexistent medical care, and lack of oversight that often ended only in the basement morgue.

U.S. District Judge John H. Pratt, who oversaw the case until his death in 1995, ruled in 1978 that conditions violated inhabitants’ constitutional rights to be held “free from harm,” ordering that the city move residents into the “least separate, most integrated and least restrictive settings” possible.

Facing court fines and intervention by the civil rights division of the Justice Department, the city embarked on a costly program to disperse residents into small, privately operated group homes.

As the District slipped into a fiscal crisis in the 1990s, promises of individualized therapy and day programs collapsed into a system of “harm, exploitation and death” that had a “guesswork budget” and no tracking system for expenditures, professional treatment plans or the hundreds of uninvestigated reports of abuse, illness and injury, Sundram said.

A 1999 Washington Post investigation reported 350 incidents of neglect and mistreatment but not a single fine for operators of 150 group homes, in a system paying $100,000 per year for each of 1,100 participants.

As late as 2006, a court monitor found that hundreds of incident reports continued to pile up, while death reports from one vendor were altered nearly half the time, with key facts or recommendations deleted by the District without agreement from the people who wrote the reports.

A turning point came after renewed litigation by the D.C.-based University Legal Services, the Center for Public Representation, a public-interest law firm for people with mental disabilities that is based in Northampton, Mass., and pro bono lawyers from the law firm Holland & Knight.

Co-lead plaintiff’s attorney Cathy E. Costanzo, executive director of the public-representation center, cited Huvelle’s appointment of a compliance administrator, Kathy Sawyer, and focus by the District’s reorganized Department on Disability Services, which Sawyer formerly led.

Still, Sundram and others warned against a return of bureaucratic inertia and low expectations. As with recently successful dieters, Sundram said, “there is a natural tendency after a period of intense effort . . . to relax. Previous bad habits can reemerge and undo achievements that have been accomplished.”