RALEIGH, N.C. (AP) — North Carolina has failed to do enough to ensure people with certain disabilities receive access to services in their communities, a judge has determined.

A ruling issued this week by Superior Court Judge Allen Baddour said the state and the Department of Health and Human Services violated a portion of the North Carolina Persons With Disabilities Protection Act.

The ruling stems from a 2017 lawsuit alleging that the obstacles people with intellectual and developmental disabilities encounter when trying to get services put them at a higher risk of being institutionalized.

Baddour ruled that the state violated a nearly 30-year-old legal mandate prohibiting situations that would force people to leave their homes to obtain treatment, Disability Rights said in a news release.

“We are pleased that the judge ruled in favor of people with disabilities having the choice to live in the community,” said Disability Rights CEO Virginia Knowlton Marcus.

In his ruling, dated Tuesday and filed in Wake County court, the judge said he would issue further decisions outlining actions that should be taken to comply with the law.

North Carolina’s Department of Health and Human Services said in a statement on Friday that it is committed to providing services and support to people with disabilities “in the most integrated setting possible, as appropriate to their needs.”

“Over the past several years, key initiatives at the department pushed toward this future, but we recognize much work remains,” the statement said.