This story was published in partnership with Capital & Mainan award-winning publication that reports from California on economic, political, and social issues.

Last fall, as presidential candidate Donald Trump promised America more oil and coal production, a small refinery town in Northern California stood up against its biggest employer and taxpayer. Valero, the Texas-based petroleum giant, had sought routine approval for a huge crude-by-rail project. The city council of Benicia, however, decisively rejected Valero’s proposal.

The project proposed to take crude oil from what is described in an environmental impact report as “sites in North America” — a possible euphemism for Bakken crude — and roll it in rail cars to Benicia. But the project proved so unpopular among the city’s nearly 27,000 residents that three of the five city council members who had started out backing the project joined in a unanimous vote against it. An energized group of local administrators and activists had managed to derail a project that national policy makers couldn’t touch.

“We had a small, but extremely well-informed group of people who have been working on these issues for a long time,” said Benicia Mayor Elizabeth Patterson, “and I give all the credit to that group.” Patterson is a longtime environmentalist who has been mayor since 2007 and was reelected in November.

Grist thanks its sponsors. Become one.

But Benicia wasn’t the only place this happened last November. Across California, new organizing efforts zeroed in on small-town elections as a strategy to thwart big fossil-fuel infrastructure projects. Oxnard officials, for example, are battling California Energy Commission plans to site a huge gas-fired power plant on a local beach, and opponents to the plan were overwhelmingly favored in the fall elections. In the Kern County town of Arvin, which 10 years ago won the dubious distinction of having the smoggiest air of any U.S. city, a 23-year-old city councilman was elected mayor on a promise to regulate the oil industry and protect the city’s water and air — a huge task in California’s biggest oil-producing county.

And on March 14, the San Luis Obispo County Board of Supervisors shut down a Phillips 66 crude-by-rail plan to bring oil into its Nipomo Mesa refinery. The 3-to-1 vote (with one recusal) against the proposal represented a huge change in a county that for years had supported refinery projects.

“[This] is a pretty new effort to work with leaders and community organizations to engage in local elections that are critical for climate and environmental justice issues,” said Whit Jones, the East Coast–based campaign director for Lead Locally, a new project of the Advocacy Fund and which provided electoral support in Benicia, Oxnard, and Arvin. “We partnered with community organizations in California last year to make sure that voters’ demands to stop oil train terminals, or to stop fracking, were heard at the ballot box.” Another new group, Leadership for a Clean Economy, also worked in these communities, in partnership with many local environmental justice organizations.

Is the hyper-local now the new way to win national battles? Fossil-fuel industries are taking note of their losses. The Western States Petroleum Association, a powerful oil industry trade group, commented in a statement to Capital & Main that such local campaigns are adding a level of regulation that is costly to the industry and that California’s climate change goals can be achieved without them. “At times, local regulations unnecessarily layer upon existing state regulations that don’t take into consideration the increasingly important role of cost containment in energy and environmental policy,” wrote WSPA president Catherine Reheis-Boyd.

Grist thanks its sponsors. Become one.

Valero did not respond to repeated requests for comment but has announced it would not fight the city council decision in court. The oil train did have a smattering of supporters, including the Benicia Chamber of Commerce, but even the attorney contracted by the city to advise on the project, Brad Hogin of Woodruff, Spradlin, and Smart, was surprised that a federal law governing the rail line did not override local concerns about dangerous oil shipments. “So it was kind of a unique legal issue,” Hogin said.

The Phillips 66 project in San Luis Obispo also started out with some local support and then was shut down for reasons similar to those in Benicia.

“In all these fights, it was totally grassroots people coming together to work with people who are advocates for various aspects of the environment,” said Andres Soto of Benicians for a Safe and Healthy Community, who worked to defeat the Benicia oil train.

National environmental groups like the Natural Resources Defense Council and the Sierra Club helped out in Benicia, but local election pressure was more important. “There was that kind of formal organizing by environmental groups, but it was spontaneous local organizing that really made the political difference,” said Soto. “That kind of local pressure can sway even people who’ve been paid by the refineries.”

When Mayor Patterson first got wind of Valero’s crude-by-rail plan, she thought it was a fait accompli. Railways, after all, are federally regulated, and not even the state can touch them. Three city council members were pro-Valero and there wasn’t much appetite in city hall to stop this project. The company employs 480 people on its 800-acre facility on the Carquinez Strait, and supplies 25 percent of the city’s tax revenue. It donates heavily to local charities — giving, for instance, approximately $723,000 to the Bay Area United Way in 2015, plus another $345,000 to 20 other local groups in 2014. That money makes a lot of good things happen in Benicia.

However, the mayor’s “small but extremely well-informed group” started looking into the issues of carrying oil by train, and the more they found, the more alarmed she became about the major air-quality issues that increased rail traffic would bring. And, in the wake of the 2013 Lac-Mégantic disaster, in which a runaway train of 74 tanker cars carrying volatile Bakken crude derailed and exploded in the middle of that Quebec town, killing 47 people, activists started looking at potential blast zones where the Valero deliveries would pass through downtown Sacramento and Davis, cutting through the Davis campus of the University of California, winding along the scenic Feather River and crossing the Sacramento River, a major source of drinking water for Southern California. Benicia certainly didn’t have emergency response capabilities or the funds to deal with a disaster if, as Patterson put it, “anything went boom.”

By the time the plan came up for a public hearing in February 2016, at least 12 other trains carrying crude had gone boom across the U.S. and Canada. Benicia Planning Commissioner Steve Young, frustrated by a rule that prevented the commission from asking questions about the Valero plan, took over that meeting and for hours publicly grilled Valero’s consultants about their Environmental Impact Report — revealing problems that prompted the commission to do an about-face and deny Valero its needed city permits.

In June, while Valero looked to the federal Interstate Commerce Commission Termination Act (ICCTA) to preempt or overrule the commission, another oil train derailed and burned near Mosier, Oregon, on the Columbia River just upstream from Portland. The accident closed Interstate 84 and schools were evacuated. Public opinion in Benicia went off the charts in opposition to the project. Lead Locally and Leadership for a Clean Economy would help turn that rage into votes.

Finally, in the middle of a city council meeting on Sept. 20, the federal Surface Transportation Board sent an informal opinion suggesting that Valero’s project was not a rail project, per se, but a local oil company project. Thus, it was subject to city planning regulation, and the council voted unanimously to kill it. Steve Young was later elected to the council.

“Once that Surface Transportation Board letter came in, the three pro-Valero people had nowhere to hide,” said Soto. “They saw that, overwhelmingly, the public was against this project.”

With the U.S. Environmental Protection Administration now headed by Scott Pruitt, a climate change denier, environmentalists may attempt more victories at the local level.

“They’re simpler, in a way,” Jones said of local policy campaigns. “The people in the community understand the issues because these things are proposed in their backyards. This isn’t some obscure, abstract conversation about the nation’s energy policy or climate change; this is about whether or not a polluting facility will be sited in their town.”

When the California Energy Commission decided in 2014 to site a new gas-fired power plant in Oxnard, it made a certain sense: The city already has three such plants on its beach, but two of those are going off-line in 2020, and the fast-start flexible gas plant proposed by power company NRG was smaller and more efficient.

Residents, however, saw their seaside paradise choked with power plants, landfills, and a toxic waste Superfund site. The town, which is 75 percent Latino and 85 percent people of color, also has to deal with pesticide issues from its heavily industrialized agricultural fields. The city birthed a new vision of itself with a deindustrialized beach and restored coastal wetlands, giving people something to believe in.

“[Oxnard has] often been seen as the region’s sacrifice zone for the most polluting industry that none of the surrounding communities want to deal with,” said Lucas Zucker, political director for CAUSE (Central Coast Alliance United for a Sustainable Economy), which is fighting the power plant. “This power plant figured very heavily in local elections.”

The Oxnard City Council is now unanimously opposed to the plant, and so is the area’s county supervisor, its state assembly member, state senator, and congresswoman. There are years of momentum behind these changes: The city banded together to oppose a proposed liquefied natural gas terminal off the coast in 2006–2007, with over 3,000 people packing a State Lands Commission meeting and pressuring officials to kill the project. Now they’ve turned their ire on the power plants. Oxnard Mayor Tim Flynn led the city council to pass a temporary ban on coastal power plants last July based on concerns over a sea-level rise that could reach the plants, and was resoundingly reelected in November. Opponents of the plant have won or retained seats despite being outspent three to one in many cases by industry-backed candidates.

In January 2017, protesters mobbed an Oxnard meeting of the California Energy Commission, which is preparing to release a final decision on the plant this summer, and effectively shut the meeting down.

“There are people who are opposed to the plant, but there is also a lot of support for it,” said NRG spokesperson David Knox, who was at this meeting, noting that proponents like the idea of a cleaner plant and energy reliability as the two old plants are retired, plus the jobs and tax revenue. NRG has estimated that replacing the plant would create 401 construction jobs and 50 demolition jobs, and generate over $16 million in increased local spending and $5.4 million in sales taxes.

Many locals, however, don’t think it’s worth it. Resistance to the Oxnard plant may have actually inspired a competing company, Calpine, to propose a gas-fired plant in nearby Santa Paula, which would supply the same area. A completely separate fight erupted there, however, slowly building local pushback, and now the Santa Paula City Council has come out against that project.

Still, Zucker notes the resistance in Oxnard and Santa Paula wasn’t well-coordinated. Even with the participation of Lead Locally and Leadership for a Clean Economy, small-town resisters are still somewhat isolated from national dialogues and from one another. When asked if his group coordinated with Benicia or other towns fighting power plants, he said, “Not as much as we should [have]. There’s not been a lot of communication.”

In the Central Valley town of Arvin, Jose Gurrola’s fight is quieter and more focused on the future. He first won city council office as a 19-year-old, inspired to do something about an oil infrastructure leak that had contaminated an Arvin neighborhood and required its evacuation for about eight months. He proposed a fracking ban in the city, but the sitting mayor voted against him. So he ran against that mayor, promising to regulate oil and gas, and, with some organizing help, won last November.

As mayor, Gurrola has pulled back from the fracking ban to do something more ambitious: revamping the city’s oil and gas code, which, he points out, hasn’t been updated “since the moon landing” in 1969. Kern County may be California’s biggest oil producing county, but today there are only four or five active wells in Arvin, and Gurrola wants to make sure they are safe, and to discourage more production and incentivize clean energy projects.

“I don’t want to necessarily call it a fracking ban at this point, because there are ways that we can write the ordinance and really make it tough for fracking to occur within the city of Arvin,” said Gurrola. “We’re looking really closely at what the city of Carson did. They have, to my knowledge, the strictest oil and gas code in the state, and one of the strictest in the entire country.”

Carson’s code does not ban fracking, but places very detailed restrictions on oil production. The city rescinded a former fracking ban and now has an agreement with oil companies to limit fracking.* It is a road map for Gurrola and his staff and attorneys, as there’s no one-stop shop for anti-fracking legislation. Despite support from a local environmental justice organization called the Center on Race, Poverty, and the Environment, and Gurrola’s connections with and Food and Water Watch, he is still left with a Herculean task to draw up an appropriate new code and implement the right legislation.

Environmentalists have barely begun their work. Whit Jones says that Lead Locally is also looking to expand nationally during elections in 2017 and 2018. “There are similar local fights where communities are trying to stop proposed fossil-fuel infrastructure, and they’re pretty similar to what we saw in California — oil train terminals, proposed oil and gas pipelines, along with power plants.”

Benicia’s Elizabeth Patterson noted that finding friends is the only way to survive. “That’s really important, to know that you’re not by yourself,” the mayor said. “Because in a local community there’s a lot of criticism: that you’re taking jobs away, they are going to stop contributing to our community. There’s some pretty heavy stuff that is said, and it’s hard to look people in the eye and say, ‘This is the right thing to do.’”

*Correction: An earlier version of this story incorrectly stated that Carson currently has a fracking ban.