Gov. Michelle Lujan Grisham signed sweeping energy legislation on Friday that calls for New Mexico’s major electric utilities to get 100 percent of their power from carbon emission-free sources by 2045.

One of the most ambitious and contentious laws passed during the 60-day legislative session that ended a week ago, Senate Bill 489 also sets up a system for financing the Public Service Company of New Mexico’s closure of a coal power plant in the Four Corners and creates job training programs for the renewable energy industry while extending assistance to laid off coal workers.

The bill’s critics have argued it will still leave PNM customers paying for the company’s investments in the coal industry and do nothing to save the jobs of workers in the sector. But an unlikely coalition of backers, which includes PNM as well as environmental groups and labor unions, views the legislation as a stride in transitioning to clean energy while boosting the expansion of an industry they say has room to grow under the state’s sunny skies and on its windy mesas.

Signing the bill in the Rotunda of the state Capitol on Friday, the newly elected Democratic governor said the bill shows “states in fact can respond to the climate change crisis.”

“This is a statewide effort, changing the dynamic and the outcomes, protecting future generations of New Mexicans forever,” she said.

Current law requires that 20 percent of New Mexico’s electricity come from renewable sources by 2020.

SB 489 raises that threshold to 50 percent by 2030 for investor-owned utilities like PNM and rural electric cooperatives.

For utilities, the bill increases that standard to 80 percent by 2040 and calls for 100 percent of power to come from carbon emission-free resources by 2045. For electric cooperatives, the bill calls for a similar goal by 2050.

The law allows the state to take reliability and costs for consumers into account when considering the new targets.

But it makes New Mexico one of only a few states officially aiming for carbon-free power. Only California and Hawaii have similar targets in place, according to data compiled by the National Conference of State Legislatures.

As part of this goal, the law encourages PNM to shut down a coal power plant in the Four Corners, the San Juan Generating Station, by creating a system to sell bonds that would make up for the money the company would lose by closing the facility.

The bonds would be paid off by PNM’s customers through electric bills.

An analysis by legislative aides said it would cost about $27 million a year.

Legislative analysts reported this would be less costly for customers than if PNM continued to operate the facility or if it sought other financing to end its operations. Both options have an estimated cost of $45 million a year, aides said.

But analysts also said this would be more costly than if PNM were allowed to recoup only half the costs of shutting the facility, which is all regulators might be inclined to allow.

Critics of the deal argued that the bill amounted to an end run around the state’s utility authority, the Public Regulation Commission, and a bailout for the company paid for by customers.

“It is unfortunate that, when we had such an opportunity to create a robust local clean energy economy for Pueblos and cities, this bill doubles down on corporate monopoly dominance and malfeasance,” said Mariel Nanasi, executive director of New Energy Economy, a leading critic of the plan. “Further, SB 489 changes and weakens bedrock consumer protections by gutting PRC authority.”

The bill also did nothing to comfort some workers who will end up unemployed when the San Juan Generating Station closes, including some who traveled to the Capitol during the session to plead for their jobs.

Lawmakers from the area also rallied against the measure, arguing for someone — anyone — to do something to save the generating station and the mine that feeds it.

Sen. Bill Sharer, R-Farmington, even filibustered the bill on the Senate floor. He wanted lawmakers to give a chance for local officials to continue talks with a New York hedge fund that was considering refitting the generating station with “carbon capture and sequestration” technologies they said would drastically reduce emissions.

The new law sets up a $20 million fund to aid displaced workers and mandates any energy sources that replace the San Juan plant’s output be located in the Central Consolidated School District, which stands to lose a big chunk of its tax revenue from the facility’s closure.

Moreover, the law sets up an apprenticeship program for the construction of new electric generation facilities.

Ultimately, the measure ended up drawing broad support, and the signing ceremony attracted an unlikely cast.

The CEO of PNM Resources attended, as did leaders of prominent environmental groups and labor unions as well as liberal advocacy groups and the president of the Navajo Nation.

The bill’s sponsor, Sen. Jacob Candelaria, noted that the bill had been described as creating strange bedfellows.

But Candelaria, D-Albuquerque, said that passing such a broad bill required having many different groups at the negotiating table.

“PNM couldn’t do it alone,” he said. “Nor could the state, nor could the environmentalists.”

SB 489 grew out of legislation Candelaria sponsored last year that would have helped PNM finance the closure of the San Juan Generating Station. That first bill spurred a political fight that ultimately doomed it.

But with a new governor who campaigned on requiring utilities use more renewable energy, the electric companies, environmentalists and the Navajo Nation all were able to get something they wanted out of the legislation to do that.