SACRAMENTO — California Republicans on Tuesday lost all six partisan down-ballot races for statewide office and saw their candidate for governor get clobbered by a Democrat.

Still, many political experts see hope on the horizon for the Golden State’s beleaguered GOP.

Republicans came within a few percentage points of victory in the secretary of state and controller contests. They also clawed back to relevance in the state Legislature, denying Democrats the supermajority they sought to reclaim in the Senate and threatening their dominance in the Assembly. And there’s a good chance they’ll be picking up at least a couple of California congressional seats.

While these achievements may seem minor compared to the red tide that washed across much of the nation Tuesday, observers say exceeding expectations is a small victory unto itself for California Republicans, who have been losing ground here for two decades.

“If the long-term goal is to rebuild the Republican Party as a viable party, this was a win for them,” said Corey Cook, director of the University of San Francisco’s Leo T. McCarthy Center for Public Service and the Common Good. “They got close, they did not damage their brand … and they’re building a bench.”

Yes, the Republican candidate for governor, Neel Kashkari, lost the election by 17 points. But the 41.3 percent of the vote he did win far exceeds the 28 percent of voters who are registered as Republicans. Four years ago, billionaire Meg Whitman spent $144 million of her own money and captured a slightly smaller share of the vote — 40.9 percent, with 5 percentage points divided among third-party candidates.

Kashkari, who told supporters on Tuesday night that he’s “just getting warmed up,” is widely expected to run for another statewide office two or four years from now.

Controller candidate Ashley Swearengin and secretary of state candidate Pete Peterson may also be encouraged to run again for the California GOP. They both won endorsements from several major newspapers ahead of the election and came within 5 percentage points of besting their Democratic challengers — all with little help or financial support from the state Republican Party.

The GOP’s victories in some close state Senate and Assembly races may be a vindication of the “Brulte Doctrine,” as described by state GOP Chairman Jim Brulte during his party’s convention in March in Burlingame: concentrating on winnable district races rather than wasting the party’s limited resources on unwinnable statewide offices.

Republican candidates held slim leads late Wednesday in two critical races that could get the party to 28 Assembly seats. GOP candidate Catharine Baker was leading Democrat Tim Sbranti in the East Bay’s 16th Assembly District. If Baker wins, she would be the first Republican in the Legislature from the ultrablue Bay Area in years. And Democratic incumbent Al Muratsuchi trailed Republican challenger David Hadley in the 66th Assembly District along coastal Los Angeles County.

“A lot of people, like moths, like to go to the light, and the light is those big races” at the top of the ticket, Brulte said in March. But rebuilding the party requires “grinding it out on the ground” in local races — a strategy that will take several election cycles to bear larger fruit.

Democratic Reps. Ami Bera and Scott Peters were narrowly trailing Republican challengers late Wednesday, and in the most surprising of the state’s congressional races, Democratic Rep. Jim Costa was trailing by about 700 votes to a 39-year-old dairy farmer, Johnny Tacherra.

On the other hand, the Brulte Doctrine might be a self-fulfilling prophecy, said Ron Nehring, the former GOP chairman who lost the lieutenant governor’s race by roughly 12 points.

Some experts note that it’s no coincidence that the two Republicans who came closest in Tuesday’s statewide races — Peterson and Swearengin — were the two who identified with their party the least, underscoring that the GOP brand remains toxic in the state as a whole.

But Nehring doesn’t buy that.

“The party in Maryland and Massachusetts supported their statewide candidates,” Nehring added. And despite having even lower shares of voter registration in those states — 25.8 percent and 10.9 percent, respectively — than in California, the GOP won both those governor races.

Tim Clark, consultant to Swearengin’s campaign, agreed with Nehring that just a little more support would have put her over the top.

“A million dollars of independent expenditures and we’d be calling Swearengin controller-elect this morning,” he said Wednesday. “We had the fundamentals in place; the ball was on the tee. We just needed somebody to come and drive it down the fairway.

Jessica Calefati formerly covered politics and state government for the Bay Area News Group. She previously wrote about education policy and the Newark schools for The-Star-Ledger. She's also a proud New Jersey native.

Rep. Jerrold Nadler of New York, the top Democrat on the Judiciary Committee, said there was nothing wrong with the officials expressing “private political views via private text messages.” Strzok, in particular, “did not say anything about Donald Trump that the majority of Americans weren’t also thinking at the same time,” he said.