SCITUATE – Marshfield and Scituate have been awarded nearly $8 million from the state for sea wall repairs designed to protect homes and increase safety for local residents.

The money is part of the $13.2 million in state grants and loans that the state’s secretary of energy and environmental affairs, Secretary Maeve Vallely Bartlett, announced at the Scituate Maritime Center on Tuesday.

The funding comes from the state’s Energy and Environmental Affairs’ environmental bond fund, signed last month by Gov. Deval Patrick. It also included funds from the second round of grants and loans from the state’s Dam and Seawall Repair and Removal Fund, and local matches.

Other South Shore towns were also among the award recipients.

Cohasset received a total of $1 million for work on the Bound Brook Control Dam, which controls the drinking water supply for all of Cohasset.

The tri-town water district of Braintree, Holbrook and Randolph received a total of $979,871 for rehabilitation of the Great Pond Lower Reservoir Dam as well.

State Rep. James Cantwell, D-Marshfield, said Scituate and Marshfield received the lion’s share of the sea wall repair funds. “This is the largest amount of money ever given by the state to municipalities for sea walls,” he said.

Marshfield’s and Scituate’s sea wall projects were two of the 25 proposals submitted for more than $30 million in funding, Bartlett said.

Marshfield received close to $4 million to replace 1,000 feet of the Foster Avenue sea wall from Old Beach Road to Ninth Road. Scituate received $4 million for reconstruction of about 700 linear feet of its Oceanside Drive seawall that would raise the sea wall by about two feet.

Kevin Cafferty, Scituate’s acting director of public works, said the Oceanside Drive sea wall was in poor condition and that it needed to be strengthened to help with flood protection.

Scituate Selectman Marty O’Toole agreed that the sea wall work would help protect the town. “We’re not just concerned for the homes on the water, but also the infrastructure behind them,” he said.