The usual script of industry resisting environmental regulations flipped last week in California: Major auto industry players reached a surprise deal with state officials to enact tougher fuel economy rules, circumventing the federal Environmental Protection Agency that is working to weaken them.

First reported by the Washington Post, the California Air Resources Board (CARB) alongside Ford Motor Company, Volkswagen AG, Honda Motor Company Ltd., and BMW of North America agreed to increase vehicle fuel economy of their fleets 3.7 percent year over year between model year 2022 and model year 2026.

Meeting this goal with just fuel-efficiency improvements would require car companies to average 51 miles per gallon by 2026 across all of their offerings. But the recent agreement lets automakers meet this target in other ways too, like selling more electric cars and plug-in hybrids. And while the agreement is only with California, the benchmarks are determined based on a car company’s national fleet rather than just within the state, which gives carmakers more flexibility.

It’s a huge deal for the US auto sector. The four companies cover close to one-third of new car, light truck, and SUV sales in the United States. And California is the largest passenger vehicle market in the country, with sales expected to reach close to 2 million new cars and trucks this year.

The agreement also has major implications for the environment. US greenhouse gas emissions are growing, and transportation is now the largest source of carbon dioxide. Light-duty vehicles comprise 20 percent of all US emissions. So shrinking the carbon footprint of cars is critical in limiting contributions to climate change and increasing fuel economy is a step in this direction. The cars built to the more stringent California standard can also be sold throughout the rest of the country, creating a ripple effect.

“[CARB Chair] Mary Nichols is a hero,” said Dan Lashof, director of the World Resources Institute. “It kind of shows the importance of state leadership.”

But the California deal brings up an interesting question: Why did major car companies deliberately go out of their way to negotiate more stringent rules for themselves when the Trump administration was trying to make things easier for them?

The answer ties together the strange forces buffeting the US auto industry right now, from the Trump administration’s trade war with China and Mexico to growing concerns about climate change to the rise of electric vehicles. Car companies are desperate for some stability, and the fact that four automakers would take the initiative to reach an accord with California shows they are already preparing for a world without Trump.

California’s new agreement with carmakers is weaker than Obama’s but stronger than Trump’s

California has had an exemption under the federal Clean Air Act since 1968 to set its own rules for vehicle emissions, which were often stricter than those set by the EPA. Carmakers weren’t big fans of this exception because it meant that they would either have to design cars specifically to comply with California rules or effectively California would set the standard for the rest of the country.

Currently, 12 states and the District of Columbia have adopted California’s emissions standards.

In 2012, the Obama administration worked with California, the EPA, and the Department of Transportation to set a similar benchmark for fuel economy across the country. Under the Obama-era car emissions regulations, companies would have had to reach 54.5 miles per gallon by 2025 if they were solely to meet the emissions target by increasing fuel efficiency. Shortly before leaving office, the Obama administration conducted a midterm evaluation to see if these targets were still achievable and concluded they were.

Car companies disagreed. They complained that these standards were too ambitious, that customers preferred larger crossover SUVs to small, fuel-efficient sedans, and that the midterm evaluation was rushed. So when Trump took office, several automakers and the oil industry petitioned to have the EPA re-assess the regulation. But car companies got more than they bargained for when the EPA announced instead that it was going to hold fuel economy standards at 2020 levels, which would set average fuel economy at 37 miles per gallon.

The EPA justified this weaker rule, known as the SAFE rule, on safety grounds. They used the tortured reasoning that newer cars are safer than old ones and that tough fuel-economy rules make new cars more expensive. By weakening fuel-efficiency regulations, drivers can upgrade to newer, safer cars more easily. But leaked emails showed that analysts inside the EPA determined that the revisions would actually lead to more deaths.

Automakers meanwhile started backing away from the Trump administration’s proposal, saying they still believe in increasing fuel economy every year but want more flexibility in how to meet those goals.

“They asked Trump to re-open that midterm review and all along they were expecting to get modest tweaks along the lines of what’s in this agreement that came out last week,” Lashof told Vox. “The Trump EPA went for the nuclear option of freezing the standard and trying to repeal California’s exemption.”

The EPA and CARB started negotiating to see if they could come to a compromise. But the EPA ended talks in February, setting the agencies on course for a legal showdown as state officials vowed to sue the EPA if it tried to revoke the Golden State’s special status. And California is ready to scrap with the federal government; the state has already filed more than 50 lawsuits against the Trump administration.

The automakers initiated the deal because they hate it when regulations are unsettled

Faced with the prospect of different sets of rules across the country with changes hinging on the uncertain outcome of long, drawn-out litigation, some car companies decided to establish a backchannel with California to see if they could reach an agreement of their own.

“They came to us, actually,” said David Clegern, a spokesperson for CARB. “My understanding is that they basically were to the point where they needed some kind of signal to provide some certainty for their planning.”

The big concern for companies is that cars take years to develop. The sedans, coupes, crossovers, and hatchbacks of the next decade are already on the drawing board, but they can’t go much further without designers knowing the mileage rules that will be in place several years in advance. That’s why coming to an agreement with one of the strictest states for emissions in the country right now works in favor of manufacturers.

“We’re focused on achieving regulatory certainty for our business rather than engaging in litigation,” said Rachel McCleery, a spokesperson for Ford, in an email. “An automaker that complies with this voluntary agreement should automatically comply with [the EPA SAFE rule], which is expected to have GHG standards that are significantly less stringent.”

Another factor is that these companies have a global presence. In other parts of the world, vehicles are facing more stringent fuel-efficiency regulations as concerns about health and climate change mount. Many car companies would rather build their offerings to similar standards than precisely tailoring their vehicles to different emissions standards in different countries. There is also a growing appetite for electric vehicles and stricter fuel-economy rules give companies a stronger incentive to promote zero-emission cars and trucks.

The recent deal between CARB and the four automakers has the added assurance that fuel economy rules won’t suddenly ramp up. “If there is a Democratic administration that comes in 2020 and wants to reinstate the Obama rules, in California we will hold them to this deal,” Clegern said.

However, it’s important to remember that the California agreement is also voluntary, and it’s not clear right now whether the car companies responsible for the other two-thirds of sales in the US will join it, though some said they were open to the idea. “We have been clear throughout the federal rule-making process that the current standards need to be adjusted to reflect changing conditions in the marketplace, and today’s announcement acknowledges that is true,” said Eric Mayne, a spokesman for Fiat-Chrysler, in an email. “We look forward to reviewing the details of this agreement as well as the federal rule later this year.”

That car companies would voluntarily agree to tougher rules adds weight to California’s case that their standards are feasible if the federal government were to challenge them. But manufacturers still want to make sure that rules are standardized across the country, and that prospect is still up in the air. That means the big thing that automakers want — regulatory certainty — is still out of reach for the time being, adding to industry frustrations.

“Our focus remains on working with all parties on a solution that would involve a 50-state solution and a national electric vehicle program,” said Jeannine Ginivan, a spokesperson for General Motors, in an email.

For its part, the EPA has shrugged off the recent deal. “This voluntary framework is a PR stunt that does nothing to further the one national standard that will provide certainty and relief for American consumers,” EPA spokesman Michael Abboud told E&E News.

The EPA expects to finalize the SAFE rule later this year, which would make it the second major climate change regulation undone by the Trump administration. The agency has already repealed and replaced the Clean Power Plan, the Obama regulation that limited greenhouse gas emissions from power plants.