Still, not every Californian is lining up to join the opposition. Representative Kevin McCarthy, the Republican House majority leader, has stood firm with the president, was a strong supporter of the tax bill, and has said he believes there is still an opportunity for Democrats and the administration to come together, particularly on immigration. In an interview with Fox News on Friday, he said, “I think there is a plan for securing the border, for dealing with chain migration.” He added, “I think there is a common ground that both sides can get to.”

But California’s diversity — 40 percent Latino, and with an estimated 2.3 million undocumented workers, according to a Pew Research Center survey — is regarded by many people here as a powerful counternarrative to the Trump administration’s anti-immigration policies and the ugly racial incidents and outbursts of white supremacy that have surfaced during his presidency in places like Charlottesville, Va.

Beyond demographics and politics, charting its own course is part of the identity of California. “We are the frontier,” said Sherry Bebitch Jeffe, a political scientist at the University of Southern California. “Beyond us, there’s nothing but ocean.”

California is not the only liberal state standing up to the Trump administration. But as the most populous state, with close to 40 million people — if it were a country it would be the world’s sixth largest economy, sandwiched between Britain and France — California has been energized in the age of Trump to take the lead in opposing what many here believe is a depressing reversal of American progress.

“California has distinguished itself from the federal government for a long time,” said Elizabeth Ashford, a political consultant who has worked for Gov. Jerry Brown, former Gov. Arnold Schwarzenegger and Senator Kamala Harris. “Certainly Arnold spent a lot of time talking about California as almost a nation-state. And many Californians feel that way.”

She continued, “For Californians and California there’s always this concept of a Golden State, a model of what a state can be and achieve.” These days, with the country roiled by a resurgence in white supremacy and nasty fights over immigration and diversity, essentially a battle over American identity, she said, “there are sharp distinctions that many Californians are drawing between us and them.”