ON NOVEMBER 9th, as it started to sink in that Donald Trump would be their president too, Californians expressed their anger and disappointment in different and creative ways. Some took to the streets and burnt papier-mâché effigies of Mr Trump’s bronzed face. Others chanted “not my president” and waved signs that read “Immigrants Make America Great” and “Deport Trump”. Kevin de León and Anthony Rendon, the leaders of the California Senate and Assembly, respectively, released a statement.

“Today, we woke up feeling like strangers in a foreign land, because yesterday Americans expressed their views on a pluralistic and democratic society that are clearly inconsistent with the values of the people of California,” it read. “We will lead the resistance to any effort that would shred our social fabric or our constitution.” As Mr Trump takes residence in the White House, California’s lawmakers are putting their words into action.

They will have plenty of examples to follow. During the Obama administration, Texas and Oklahoma were strident advocates for state sovereignty. Several other states also challenged the federal government in court and by making their own laws. Indeed calls for states’ rights and limited federal power have been a defining feature of American conservatism since the New Deal, says Ilya Somin, a federalism expert at George Mason University. But with the election of Mr Trump, whose party controls both houses of Congress and who plans to appoint conservatives to the Supreme Court, it is Democrats who find themselves turning to the states as bulwarks of resistance. California, America’s most populous and progressive state, will lead the blue-state opposition.

California has plumped for Democrats since the early 1990s—Hillary Clinton won by a margin of 30 percentage points. It is one of six states where Democrats hold the governor’s mansion and both houses of the state legislature. But Californians’ opposition to Mr Trump goes beyond partisanship. If America’s new president honours his promises to deport illegal immigrants, repeal the Affordable Care Act (better known as Obamacare) and relax environmental protections, California—America’s largest economy—stands to lose more than any other state.

More than 3m undocumented immigrants call the Golden State home, reckons the Migration Policy Institute, a think-tank. (Texas, the second most popular state for undocumented foreigners, has less than half as many.) These workers make up nearly 10% of the workforce and contribute $130bn—or about 5%—of the state’s annual output, according to a 2014 study. Health Access California, a consumer advocacy group, estimates that the state government could lose $22bn in federal funding annually if Obamacare is gutted; some 5m Californians could find themselves without health coverage. And even though Mr Trump has vowed to axe Barack Obama’s Clean Power Plan, which would have regulated carbon emissions from power plants, California is likely to continue complying with—or even exceed—the requirements laid out in the framework. But its companies might find themselves at a competitive disadvantage if other states do not.

Politicians from California and other blue states plan to resist Mr Trump using three main tools: legislation, litigation and circumvention.

Start with legislation. On December 5th California’s lawmakers introduced a package of laws to impede mass deportation. One bill would create a programme to fund legal representation for immigrants in deportation hearings. Andrew Cuomo, the governor of New York, announced earlier this month that he would launch a similar fund. A recent national study found that immigrants with legal counsel were five-and-a-half times more likely to avoid deportation than if they represented themselves. Yet only 14% of detained immigrants in deportation proceedings had lawyers. Gun control, health care and environmental policy are other areas where Democrat-dominated states might focus in the coming years, says John Hudak, a fellow at the Brookings Institution.

The leaves are brown

Several states are also getting ready to challenge the Trump administration in court. Maura Healey, the attorney-general of Massachusetts, which has a Republican governor, and Eric Schneiderman, the attorney-general of New York, have both expressed their willingness to square off against the federal government. Earlier this month the California State Legislature announced that it had retained Eric Holder, who served as Mr Obama’s attorney-general, as outside counsel. He will work with the state’s next attorney-general to bring suits against the federal government. California’s decision to hire outside counsel is distinctive, but litigation as a means of stalling the federal government is hardly new. In 2010 a group of mostly Republican attorneys-general filed a lawsuit to block Obamacare. According to analysis by the Texas Tribune, the Lone Star State sued the Obama administration at least 48 times during Mr Obama’s term. Hiring Mr Holder “sends a message to the administration about the state’s resolve to defend our people, our diversity, and economic output,” says Mr de León.

Some potential suits are starting to take shape. Gavin Newsom, California’s lieutenant-governor who will run for governor in 2018, has said that the state could sue under the California Environmental Quality Act or its federal equivalent to quash Mr Trump’s plans for a wall along the border with Mexico. The argument would rest on the claim that construction of the wall could upset water flows and quality as well as wildlife. Richard Revesz, an environmental-policy expert at New York University’s School of Law, says Democratic states could also sue to slow the repeal of the Clean Power Plan.

The final way in which blue states can resist Mr Trump’s policy agenda is by trying to get around federal policy. California already has cap-and-trade agreements with foreign jurisdictions such as Québec. Mr de León says that, under the Trump administration the state will work to expand such programmes. Since 2009 nine states in the north-east have participated in the Regional Greenhouse Gas Initiative, a cap-and-trade programme. Even if climate protections are relaxed under Mr Trump, such an alliance could continue.

On immigration, California has legislation preventing local jails from holding people for extra time just so that federal immigration enforcement officers can deport them. So-called “sanctuary cities” in other states, including Chicago, New York, Seattle and others, have pledged to protect their undocumented residents in similar ways. Such policies are likely to be effective at obstructing a massive dragnet; there are 5,800 federal deportation agents compared with more than 750,000 state and local police officers. Deporting undocumented immigrants without local co-operation is much more difficult.

Mr Trump has threatened to cut federal funding for jurisdictions that insist on adhering to “sanctuary” policies, but Mr Somin suggests that courts may not look kindly on such an action. In 2012 the Supreme Court ruled that the federal government cannot force states to bend to its wishes with a financial “gun to the head”. Although much about the next four years is unpredictable, one thing seems clear: the courts will be busy.