So California has declared itself to be a sanctuary for those who have entered the nation illegally.

“This action protects public safety and ensures hard-working people who contribute to our state are respected,” Gov. Jerry Brown said as he signed a package of bills aimed at protecting at least 2 million undocumented residents from being detained and, perhaps, expelled.

It’s California’s most dramatic “resistance” to President Donald Trump, at least so far, and seems destined to provoke his administration, particularly Attorney General Jeff Sessions, into a confrontation.

After Brown signed the bills, Trump’s top immigration official, Tom Homan, declared that Senate Bill 54, the centerpiece measure, undermines public safety and “the governor is simply wrong when he claims otherwise.”

SB 54 “will inevitably result in additional collateral arrests, instead of focusing on arrests at jails and prisons where transfers are safer for ICE officers and the community,” Homan, acting director of Immigration and Customs Enforcement, warned.

Although Brown insisted on changes in SB 54 to enlarge the number of crimes meriting federal immigration action, Homan’s position is bolstered by the state’s sheriffs.

“Although we appreciate the governor’s efforts to mitigate the most dangerous provisions of SB 54, we are discouraged that this problematic bill has been signed into law,” the California State Sheriffs Association’s president, Bill Brown, said, citing serious crimes whose perpetrators will be protected.

Were federal immigration authorities to ignore California’s new sanctuary laws, it’s difficult to say how the state would respond, or what the outcome would be. At the very least, there would be litigation.

At its heart, the conflict is over whether one state can, in some manner, supersede federal authority on an issue – immigration – that is clearly in the federal purview. Can California, in effect, quasi-legalize those who entered the country illegally?

Eventually, the federal courts will have the last word – unless, of course, Congress and Trump do something that should have been done years ago: enact comprehensive immigration reform that would give otherwise law-abiding immigrants a pathway to legal status and/or citizenship.

Democrats could have done it when they controlled Congress and the White House but didn’t. A cynic would say that they preferred to keep the issue alive for political purposes, such as organizing Latinos as a political bloc. But whatever the reason, they did not follow through on promises to act.

Republicans could do it now, but a cynic would say they don’t want to do it because illegal immigration is a motivating issue for their political base and they don’t want 11 million new voters who would certainly lean Democratic.

The most optimistic view is that California’s new sanctuary laws and the emotional angst over undocumented immigrants who were brought into the country as children might generate enough movement to make something happen – a grand bargain to make illegal entry more difficult, but protect those children and their families from deportation and offer a pathway of some kind to others.

The most pessimistic is that California’s go-it-alone position will entice a tougher response from the Trump administration and harden opposition to immigration reform in the rest of the nation.

The issue has festered much too long, not only to the detriment of the undocumented, but to society as a whole. California is particularly dependent on immigrant workers for its multi-faceted economy and labor shortages in agriculture, construction and other fields attest to how the threats of deportation have reverberated.

Enough is enough.