PORTLAND (AP) — A federal judge in Maine has approved a settlement in a class-action lawsuit on behalf of people with long-term disabilities who claimed that the state should create opportunities for them to live outside nursing homes.

U.S. District Judge Nancy Torreson approved the settlement Wednesday in a suit brought against the Maine Department of Health and Human Services in 2009 on behalf of three young men with cerebral palsy who had lived in nursing homes for a number of years. The court allowed 40 others with cerebral palsy, epilepsy and other conditions to join the suit last year, making it a class action.

The suit claimed DHHS failed to create opportunities for the plaintiffs to live outside of nursing homes, in violation of the Americans with Disabilities Act and the Nursing Home Reform Act.

The settlement requires the state to offer home- and community-based services to those individuals who now reside in nursing homes or are at risk of having to move into nursing homes. DHHS also agreed to improve the types of services the class members receive while they live in nursing homes.

“The resolution achieves what our clients wanted from the state — a chance to live independently in the community and not be segregated from their peers,” said Jack Comart, litigation director for Maine Equal Justice Partners, which helped bring the suit.

DHHS Commissioner Mary Mayhew said the class members will have a greater range of opportunities when the community living program is approved by the federal Centers for Medicare and Medicaid Services.

“In addition, the department is committed to reviewing its assessment process for services that will comprise a continuous and active treatment program,” Mayhew said in a statement. “We appreciate the collaborative nature of our discussions throughout the process and are pleased with the outcome.”