By Inauguration Day, the shock and anguish many Democrats experienced immediately following November’s election had settled into a dense dread. All the quixotic attempts to reverse the results — the recounts, the search for “Hamilton Electors” — had failed, and the new Congress had been sworn in. All that was left was for Trump to take the oath of office.

Democrats have good reason for alarm. In anticipation of a united government, Republicans in Congress have already initiated the repeal of the Affordable Care Act. Hard-right Cabinet nominees have been put forward. Privatization of education and Medicare, deregulation of the environment and the finance industry, and conservative court nominees are all on the docket.

Related 7 paths the Trump presidency could take

So, yes, there is reason to despair. But there is also cause for cautious hope. At the very least, a historical precedent exists that suggests Trump’s election could energize the left and center-left in a way that could alter the American political terrain in ways that benefit Democrats for years, if not decades, to come: namely, the case of California and Proposition 187.

The draconian anti-immigration initiative of 1994 helped turn the nation’s most populous state blue. California’s electoral votes had gone to the Republican candidate every presidential election between 1968 and 1988. But the tide started to turn against Republicans when they overreached on an issue that Trump has made his own: stoking nativist fears about immigration. By 2012, Democrats held a supermajority in the state legislature. By 2016, California was so solidly Democratic that commentators now speak of it as a liberal quasi-nation counterbalancing Trumpland.

Could Trump’s election, which has triggered such despair in liberals, similarly jolt the United States into following a Democratic-friendly course?

Californians were “economically anxious.” They blamed immigrants.

In California, the story began with a personal vendetta against an imaginary illegal immigrant. Well, the immigrant himself wasn’t imaginary. He was Leonard Chornomud, a business partner of Ronald Prince. Prince charged that Chornomud not only swindled him out of $500,000 but was in the country illegally. (This was false; Chornomud had immigrated legally from Canada in 1961.) But the incident catapulted Prince into anti-immigrant activism. He joined up with other Californians more concerned with immigration across the country’s southern border than about incursions from the north — and Proposition 187 was born.

Formally titled “Illegal Aliens. Ineligibility for Public Services. Verification and Reporting,” the initiative was popularly known as “Save Our State.” It proposed stripping anyone who had entered the country unlawfully of all public services, including education and non-emergency medical care. It did all this in the name of “the People of California,” arguing that “illegal immigrants” were to blame for their economic hardships and personal suffering.

The people of California were indeed suffering in the early 1990s. The end of the Cold War may have been a triumph for liberal democracy, but the defense drawdown was disastrous for the Californian economy. Bases and factories closed; opportunities dried up. Joan Didion catalogued the decline for the New Yorker in a famous 1993 essay, “Trouble in Lakewood.” In it, she quoted the wife of an Orange County aerospace engineer who accurately linked the rising anti-immigration sentiment in the state to its economic decline. “Orange County is using illegal aliens now as a smoke screen,” she said, “as a scapegoat, because that way we get the white lower-income people to jump on board and say the immigrants are the problem.”

“Scapegoat” is the right word. Pro–Prop. 187 groups blamed an increase in undocumented immigrants for overcrowded schools and strained state budgets. But immigration — both authorized and unauthorized — was down in California in the early 1990s, as it almost always is during economically challenging times. The budget had thinned due to tax cuts, and overcrowded schools were the result not of increased enrollment — in Los Angeles, enrollment was actually down from the late 1960s — but of a wave of school closures driven, yes, by tax cuts.

Concerns about immigration became mixed with a harsher nativism

Though the proposition was framed around the legal status of immigrants, the campaign quickly became a debate about immigrant versus native-born and white versus nonwhite Californians — a phenomenon familiar to anyone who watched the 2016 presidential campaign unfold. Pete Wilson, running for reelection as governor in 1994, aired an infamous ad that showed grainy footage of Mexican migrants racing across the border as a narrator intoned, “They keep coming,” and, “Enough is enough.” The fear-stoking ad made clear Prop. 187 was about Latinos and immigration, not visa overstays (let alone Canadian business partners).

Research backs this up. In a series of interviews with Prop. 187 supporters, political scientist Robin Dale Jacobson noted that while supporters would first offer seemingly colorblind defenses of the initiative — concerns with law or with the state budget — they almost all soon shifted to racial defenses that made clear the “our” in Save Our State meant that the state was, ultimately, the property of white and native-born Californians. As one supporter put it, “When you look at this country, you see it’s kind of an island of English-speaking people surrounded by Latinos. Lots of Mexicans. … You know you’re an island here and eventually that island’s going to be swamped.”

Latinos in the state organized in protest. Opposition to the initiative flowed from across the political and economic establishment, and grew to include most California newspapers, professional groups, law enforcement organizations, and corporate leaders, plus a few national Republican leaders like Jack Kemp and Bill Bennett. To no avail: In November 1994, Proposition 187 passed with 59 percent of the vote.

What happened next is most often told in shorthand: Prop. 187 ensured Latinos would never vote Republican, and as the state became less white, it became more blue.

But that story hands control of California’s destiny to demographics rather than politics. And Prop. 187’s aftermath is all about politics. That holds a lesson for the response to Trump, as well.

The “Prop. 187” narrative is less neat than it sometimes seems

For starters, it’s important to understand that the Democrats in the state were not always natural allies of Latinos. As Daniel HoSang notes in Racial Propositions: Ballot Initiatives and the Making of Postwar California, it was Dianne Feinstein, a Democrat recently elected to the US Senate, who first pointed to undocumented immigrants as a central problem of the Californian economy. Many leading California Democrats were immigration hawks in the early 1990s, finding it a resonant issue in the era of Third Way Democratic centrism.

The same was true for many Prop. 187 opponents generally: They may have opposed the initiative, but they were hardly walking hand in hand with members of the threatened community. Taxpayers Against 187 argued that “illegal immigration is a REAL problem, but Proposition 187 is NOT A REAL SOLUTION.” As HoSang notes, in arguing against the initiative, Taxpayers Against 187 put middle-class concerns front and center. The group argued that if undocumented children were kept from school, they would become delinquents swarming the streets, and if undocumented workers were kept from health care, they would spread disease to people eating at the restaurants where they worked. Thin gruel for coalition building with Latinos.

Fortunately for Democrats, there were other groups in the state, like Californians United, that worked both before and after the vote to build coalitions around human and civil rights. They argued that people who provided labor in the state had a right to education and health care — not because those public services protected native-born Californians, but because they were owed to people who were part of the state’s economy and community.

After the election, Californians United turned to local community activists to organize citizenship classes and voter registration drives. These activists understood that the way to win was not to focus solely on the needs of white and middle-class voters. Instead, they worked to bring in Latinos, African Americans, and Asian Americans who may not have been active voters but who understood the danger of the state’s growing nativism to their own interests. Those efforts helped shepherd more than a million Latino immigrants through the process of naturalization and voter registration. (At the same time, the state’s Asian Americans were becoming far less Republican, dropping from around 30 percent Republican in 2002 to 22 percent in 2014, a period in which the number of Asian Americans living in the state nearly doubled.)

And Democratic leaders in the state came to realize that their future lay not in demonizing the growing Latino voter base, as part of an appeal to discontented white voters, but bringing them into the party as equals.

As California goes, so goes the nation. That’s the working theory, anyway. In the 1950s and ’60s it was a reliably Republican state, home of the emerging conservative movement. The John Birch Society flourished in the state’s suburban enclaves. Ronald Reagan honed his political chops as governor there before moving up to the White House. Today the state is a liberal enclave. So should Democrats find solace in California’s rapid transformation into a solidly blue state?

Democrats can’t sit back and wait for demographics to do their work for them

A case can be made that Donald Trump may have irrevocably tainted the Republican Party as a party of exclusion and nativism, permanently alienating Latino, Asian-American, black, and even younger white voters. But as the California example shows, demography is not destiny. Coalitions are built, not born, and they do not come into being overnight. Local activists worked for years to transform nonvoters into voters and California Democrats into a more inclusive party.

Nor, if a newly galvanized Democratic coalition emerges, will its path toward a national congressional majority be smooth. The road from Prop. 187’s passage to the state’s Democratic supermajority in 2012 was littered with losses. There were successful initiatives to ban affirmative action and bilingual education. There was Gov. Gray Davis’s recall and the election of Arnold Schwarzenegger, a Republican who had not only supported Prop. 187 but who brought Pete Wilson, the man most associated with the law, into his campaign. Schwarzenegger, now Trump’s replacement as host of The Celebrity Apprentice, won 31 percent of the Latino vote, an early indicator of how celebrity and outsider candidacies can scramble voters’ response to party ID.

What’s more, the Democratic Party in California was starting, in the 1990s, from a stronger position than the national Democratic Party today. By the 1990s, California was no longer solidly under Republican control. Yes, there were still plenty of Republican officeholders in the state, but Bill Clinton won the state in 1992, and the Democratic Party was winning more and more state-level seats. That is not the case with the national Democratic Party today, which, with some exceptions, has been decimated at the local, state, and national level.

Still, the Prop. 187 fight does provide clues for how the Democratic Party can build durable coalitions in the coming years. The focus should be intensely local, with community leaders spearheading efforts in citizenship training, voter registration, and political activism. As in California, that work should focus not just on the biannual ballot box but on organizing those local communities, through sustained activism, around a shared set of values and policy preferences.

And perhaps more relevant: Democrats won in California not by coddling the racial fears and prejudices of white native-born Californians but by building a broader coalition that recognized and responded to Latinos, Asian Americans, African Americans, and immigrants within the state. That is an important detail, given the debates coursing through the national Democratic Party today about which demographic groups should be courted, and how.

The story of Prop. 187 suggests that the road to building the new Democratic majority is long and difficult and in no way guaranteed. It will require sustained electoral organizing at a time when there are battles raging on a thousand different fronts. There will be infighting and tough losses and thorny problems without simple solutions. But the main lesson of Prop. 187 is this: Meaningful victory is, in time, possible.

Given how bleak the scene looks for Democrats today, that is a message of much-needed hope.

Nicole Hemmer, a Vox columnist, is the author of Messengers of the Right: Conservative Media and the Transformation of American Politics. She is an assistant professor at the University of Virginia’s Miller Center and co-host of the Past Present podcast.

The Big Idea is Vox’s home for smart, often scholarly excursions into the most important issues and ideas in politics, science, and culture — typically written by outside contributors. If you have an idea for a piece, pitch us at thebigidea@vox.com