State energy regulators have fined three Massachusetts utilities nearly $25 million for their response to two major storms in 2011.

The penalties were announced Tuesday by the Department of Public Utilities after an investigation that took more than a year.

Some Massachusetts residents were without power for a week after Tropical Storm Irene in August 2011 and a surprise October snowstorm that same year.

The fines are against National Grid, NStar and Western Massachusetts Electric Co.

The fines are a bit less than the nearly $30 million recommended by Attorney General Martha Coakley had recommended for inadequate response efforts. The companies had disputed her recommended fines.

Under a new state law passed earlier this year, the fines will be returned to consumers in the form of rate relief.