Bernie Sanders may have saved San Francisco Bay.

The Vermont senator was beaten handily by Hillary Clinton in the June Democratic primary, winning just one Bay Area county, Sonoma. But political strategists behind the campaign for Yes on Measure AA, a $12 parcel tax in all nine Bay Area counties to pay for wetlands restoration and flood control, say their measure passed because Democratic turnout was higher than expected.

“We call it the Bernie bump,” said Mia Hodge, a consultant with TBWB Strategies, a San Francisco firm that helped run the Yes on Measure AA effort.

Campaign officials expected that registered Democrats, who were considered more likely to support a tax for the environment, would make up 55 percent of the Bay Area turnout in the June 7 primary, and Republicans, who would be less likely to back the measure, would make up 22 percent.

But a post-election analysis by the campaign discovered that Democrats instead cast 61 percent of the ballots, and Republicans just 18 percent, with decline-to-state voters at 18 percent as well. They attribute the breakdown to the fact that Sanders remained in the Democratic presidential race through the California primary, giving his supporters, particularly young people ages 18-29, a reason to vote. Clinton supporters also had a reason to turn out.

And after voting for Sanders or Clinton, many of those same Democrats voted “yes” on the bay tax. By contrast, the Republican race was effectively over by June 7, with Donald Trump’s chief rival, Sen. Ted Cruz, of Texas, having dropped out a month before, so there were fewer Republicans to vote against Measure AA.

The conclusions were several of the key points made Friday at a meeting of the San Francisco Bay Restoration Authority, a seven-member government agency that will decide which projects will receive the $25 million a year in tax revenues for the next 20 years, or $500 million.

Measure AA passed with 70.32 percent of the vote. It needed a combined 66.67 percent in all nine Bay Area counties.

“I’m absolutely thrilled. I did not imagine we could get 70 percent approval,” said Dave Pine, a San Mateo County supervisor who serves as chairman of the bay restoration authority. “To go from 66 to 70 percent is a big deal, and really reflects people’s love of the bay, and their desire to make it better.”

A precinct-by-precinct analysis by the California Coastal Conservancy found that, in most cases, the closer a voter lived to the bay’s shoreline the more likely he or she was to vote for Measure AA, and the farther away he or she lived the less likely. The analysis showed that San Francisco, Oakland, nearly every Peninsula shoreline community, San Jose, Marin and large parts of the Contra Costa shoreline population all supported Measure AA by more than two-thirds.

In inland areas such as northern Napa and Sonoma counties, eastern Contra Costa and most of southern Santa Clara County, a majority voted no.

“The farther away you go from the bay, the more it tailed off,” said Larry Gerston, a professor emeritus of political science at San Jose State. “People were asking, ‘How am I affected by this? The bay? What bay? Discovery Bay?’ There was no real connection as you got farther away from the issue at hand. All politics is local.”

With major donors like Save the Bay, the Nature Conservancy, the Audubon Society, PG&E, Facebook and members of the Getty and Packard families, the Yes campaign raised $3 million, spending about half on TV ads. Much of the rest went toward direct mail sent to 350,000 absentee voters, social media, and newspaper ads in Spanish, Chinese and Vietnamese language newspapers. The campaign won endorsements from Gov. Jerry Brown, Sens. Dianne Feinstein and Barbara Boxer, the Silicon Valley Leadership Group, the Bay Area Council and other influential players.

By contrast, the No on AA effort did not field an organized campaign, had almost no endorsements from Bay Area political leaders, and was largely made up of a loose coalition of anti-tax groups.

The measure cleared 50 percent support in all nine Bay Area counties.

The highest support came in San Francisco County, with 77.6 percent, followed by Alameda (75.2 percent), Marin (73.5 percent), San Mateo (72 percent) and Santa Clara (70.1 percent). Surprising many political experts, Contra Costa County voters approved of the measure by 65.7 percent. Less support came from Sonoma County (64.3 percent), Napa County (59.1 percent) and Solano County (54.3 percent).

The tax will show up on property tax bills next July. The restoration authority has identified 99 potential projects for the money, including levee strengthening efforts in the South Bay, wetland restoration in most counties, and new trails, fish and wildlife projects. The authority will appoint a financial oversight committee, as the measure required, and plans to award grants starting in January 2018.

“We’re thrilled,” said Beckie Zisser, with Save the Bay, based in Oakland. “There’s never been a pot of money available for the bay like this. We as a region have stepped up.”

Paul Rogers covers resources and environmental issues. Contact him at 408-920-5045. Follow him at Twitter.com/PaulRogersSJMN.