The state of Massachusetts has issued an unprecedented $24.8 million in fines against three utilities for their inadequate response to the power outages that plunged hundreds of thousands of people in the dark after Tropical Storm Irene and the Halloween snowstorm last year.

The state Department of Public Utilities said the money would be returned to customers of the utilities. National Grid has been ordered to pay $18.725 million; NStar has been ordered to pay $4.075 million; and Western Massachusetts Electric Company has been assessed $2 million.

The fines were the first ever levied by the DPU against utilities for their storm responses. NStar immediately said it would appeal the fine to the state Supreme Judicial Court.

Advertisement - Continue Reading Below

“Regulated utilities must be accountable to the residents they serve. After conducting a thorough investigation, the Department of Public Utilities has done just that,” Governor Deval Patrick said in a statement.

“I trust this will encourage the utilities to refocus their efforts on preparation for and response to weather events in the future,’’ the governor said.

Werner Schweiger, president of NStar Electric, said, “We strongly disagree with the department and are disappointed that they have dismissed the tireless effort put forth by our employees to respond to customers after these historic storms.”

“The amount of devastation our system sustained last fall cannot be understated – with an estimated 80 percent of our overhead circuits damaged after Irene alone. We were essentially rebuilding the electric system as we restored power, and the penalties assessed today are simply not in line with the realities of getting the job done,” he said.

In a statement, National Grid said it had not yet decided whether to appeal the fine.

“We will need some time to evaluate the order fully to consider our options going forward,” the company said.

The company said it had made many changes to its emergency plans that were put into practice during superstorm Sandy and last month’s nor’easter.

Regulators said their findings were based on 16 public hearings, 13 evidentiary hearings, and more than 1,200 exhibits. They concluded that the utilities failed in their public safety duties during their response to local public safety officials regarding downed wires.

“As the number of serious weather events has risen dramatically in Massachusetts, it’s crucial for ratepayers to have electric service that is both safe and reliable,’’ Energy and Environmental Affairs Secretary Rick Sullivan said in a statement.

The DPU found “systematic failures’’ in the National Grid response to the two storms, and ordered that the company hire an outside firm to review its practices and recommend new ways to respond to major storms.

National Grid “left local public safety officials standing by downed wires for as long as several days, had a seriously inadequate response for priority facilities like nursing homes and sewage treatment plants, and secured too few crews, too late,’’ officials said.

During Tropical Storm Irene, about half of NStar’s customers lost power, and the utility “performed reasonably under the circumstances,” the DPU concluded. But the department also found that the “company took far too long to respond to priority calls from public safety officials regarding downed wires and did a poor job of communicating with customers.’’

During the Halloween storm, the DPU said, NStar called customers to report their power had been restored, when, in fact, people were still in the dark.

Tropical Storm Irene did not hit Western Massachusetts, so the DPU focused on Western Massachusetts Electric Company’s response to the Halloween snowstorm. The DPU said WMECO was given credit for having “managed the storm well.’’

But WMECO, like the other utilities, did not respond fast enough to public safety officials when they reported downed power lines, the DPU found.

“The DPU understands that there will be many thousands of outages in bad storms like Tropical Storm Irene and the October snowstorm. These will not be the last severe storms we see, and the public cannot expect that the utilities can prevent outages in events of this magnitude,” Ann Berwick, chair of the DPU, said in a statement.

“On the other hand,” she added, “public safety will remain our absolutely highest priority, and we will not tolerate inadequate responses to local public safety officials. Additionally, in this day and age, we expect competent communications with towns and customers alike.”

Massachusetts Attorney General Martha Coakley said the fines sent a clear message that “customers deserve better.” Coakley’s office had recommended record penalties against the utilities and that the money be returned to customers.

Martin Finucane of the Globe staff contributed to this report. Peter Schworm can be reached at pschworm@globe.com