NextEra Energy Inc. has ended its plan to buy Hawaiian Electric Industries Inc. and will pay the state’s largest utility $95 million in “break-up” fees and other costs, the two companies announced early today.

The announcement came after the state Public Utilities Commission, in a 2-0 vote Friday, rejected the Juno, Fla.-based company’s $4.3 billion offer to takeover HEI. PUC approval was needed for the companies to close the deal. NextEra and HEI could have challenged the PUC decision, but instead will walk away from the deal.

“As a result of the PUC’s order, we have terminated our merger agreement,” Jim Robo, NextEra’s chairman and chief executive, said in a news release issued before U.S. stock markets opened this morning. “We wish Hawaiian Electric the best as it serves the current and future energy needs of Hawaii, including helping the state meet its goal of 100 percent renewable energy by 2045.”

The PUC, in its rejection, expressed doubts about NextEra’s commitment to the state’s lofty renewable-energy goal and said its decision does not prevent Hawaiian Electric from seeking another partner.

Connie Lau, HEI’s president and chief executive, said in the news release, “We appreciate NextEra Energy’s interest in Hawaii and in our company. All of us at HEI, Hawaiian Electric and American Savings Bank remain committed to serving our customers, and we look forward to working together with communities across our state to realize the clean energy future we all want for Hawaii and to ensure a vibrant local economy.”

The companies said NextEra Energy will pay HEI “a $90 million break-up fee and up to $5 million for reimbursement of expenses associated with the transaction.”

In a separate announcement this morning, HEI said that after taxes, the company will gain $60 million from the break-up fees and costs, which “will help to fund Hawaii’s clean energy transformation.” A one-time cash dividend of 50 cents a share of HEI common stock, which would have been paid if the merger closed, will not be issued, the company added.

On Wall Street, HEI’s stock closed today at $30.10, down $2.38, or 7 percent, while NextEra shares closed at $128.25, up 67 cents, or less than 1 percent. The PUC’s rejection of the deal was announced after the markets closed Friday.

The break-up fee was part of the merger agreement announced in early December 2014. NextEra and HEI then spent the next 19 months trying to win over shareholders, regulators, politicians and customers with promises of cheaper electricity rates and greater resources. But the deal was opposed by Gov. David Ige, and several environmental groups and solar-power companies. Opponents said selling HEI to NextEra would stall the progress Hawaii has made toward shifting to renewable energy, including rooftop solar panels.

HEI, through its subsidiaries Hawaiian Electric Co. on Oahu, Maui Electric Co., and Hawaii Electric Light Co. on the Big Island, provides power to 95 percent of Hawaii residents. HEI’s bank subsidiary, American Savings Bank, which was to be spun off if the deal went through, will continue to operate as part of HEI.

NextEra has about 14,300 employees in 27 states and Canada. Its major subsidiaries include Florida Power & Light Co, with 4.8 million customers, and NextEra Energy Resources, with 110 wind farms in 19 states.