PROVIDENCE, R.I. — A Providence Superior Court judge has ordered the state Division of Public Utilities not to allow National Grid to shut off utility service until autumn to people who are handicapped or seriously ill.

It follows a consent order in which National Grid, the state's primary electric and gas utility, agreed to do more to ensure it is not shutting off utilities to medically vulnerable people.

The moves affect thousands of people and come in response to a class-action lawsuit filed last year by the nonprofit groups the Rhode Island Center for Justice and the George Wiley Center.

The lawsuit said that the utility was violating Rhode Island law that protects people who have serious illnesses or disabilities from having their utilities shut off. It also said that the Division of Public Utilities was not enforcing the laws.

A spokesman for National Grid said the company will comply with the terms of the consent decree, but did not comment further. A spokesman for the Division of Public Utilities also did not comment in detail.

Robert McCreanor, executive director of the Rhode Island Center for Justice, said the consent order entered into this spring represents a substantial overhaul of National Grid's customer service, debt collection and shutoff practices. Under the order, the utility has to notify households that they may seek protection from shutoffs.

McCreanor said it affects more than 4,000 households that include one or more medically vulnerable people.

"The most vulnerable are those that are dependent on life-sustaining equipment, oxygen, feeding tubes, folks who need to refrigerate their medicine," he said. "There are many households in that group for whom electric and gas service is also critical to maintaining sanitation, households for whom loss of a utility services poses a significant hardship because they're physically disabled."

Those households will be able to get a note from a doctor to confirm that they are vulnerable. While that process is going on, none of these affected households can be shut off, even if they are behind in their bills.

While National Grid is bound by the consent order, the lawsuit against the Division of Public Utilities continues. Superior Court Judge Netti Vogel last month ordered a hearing in that lawsuit on Sept. 26.

McCreanor said at the conclusion of the hearing, she is expected to decide when and under what circumstances the shutoff review process can resume.