Immigration reform is dead. Democrats have effectively ­immured it behind their own ideological Wall.

The debates over border security, so-called Dreamers brought here as children, the asylum process and how to deal with the 11 million or more illegal immigrants already here continues.

But the attacks on the Trump administration’s policies and the open-borders pledges of the 2020 Democratic field have extinguished any hope of a long-term compromise.

That’s a tragedy. Liberals’ toxic rhetoric is driving an already-divided country further apart. Everyone knows repairing our dysfunctional system is a national imperative. Yet it’s no longer possible to imagine Republicans and Democrats working together to make the necessary fixes.

A few years ago, many in both parties were amenable to compromise. Democrats wanted a bill that would grant a path to citizenship to the illegal immigrants already in the country. But they knew they would have to pay for a path to citizenship by agreeing to massive spending on border security.

Democrats would thus trade amnesty for ­security guarantees to prevent another massive influx of illegal immigrants. (That’s what happened after a similar deal made during the Reagan administration.)

A bipartisan compromise failed in 2013 because conservatives believed border security must come first. And conservatives were soon proved correct: Even the mere discussion of an amnesty bill generated an increase in illegal immigration.

President Barack Obama’s extra-constitutional executive ­orders that granted amnesty to Dreamers and their families as well as the spread of a “sanctuary” movement that granted immunity to illegals likewise created surges at the border.

To his credit, President Trump ­offered a deal that would have taken care of the Dreamers in ­exchange for funding for a border wall that — despite the derision the project and his false promises about Mexico paying for it generated — was needed. But the Democrats were more interested in ­demonizing Trump and refused his offer.

The debate has become even more polarized in the last year.

Democrats no longer even pay lip service to the need to stop illegal immigration. Their new extremism led the New York Legislature to enact a law granting driver’s licenses to illegal immgrants last month.

New York has also banned ­Immigration and Customs ­Enforcement agents from making arrests in state courts and is now moving to do the same for ­local venues, declaring state courthouses sanctuaries.

Even worse, the left has misrepresented the surge at the border of a population of economic migrants as the moral equivalent of Jews fleeing Nazi Germany. Efforts to cope with the massive influx of people making largely false claims of asylum have been smeared by Democrats as Gestapo tactics and detention centers falsely labeled as “concentration camps” by radicals like Rep. Alexandria Ocasio-Cortez.

The separation of children from those accompanying them — many of whom are not their parents but people who are merely using them to evade imprisonment — may have seemed cruel, but the “catch-and-release” alternative flashed a green light for even more to head across the border. That created the current humanitarian crisis, which Democrats — naturally — refuse to address with funding.

Democratic presidential candidates are also now nearly unanimous about decriminalizing illegal immigration while speaking of the undermanned agents trying to enforce the law as “kidnappers” and criminals. Democrats are also united in giving illegal migrants free health care at the expense of already overburdened US taxpayers. The GOP isn’t lying when it refers to this mindset as indistinguishable from open borders.

The Democrats’ rhetoric has made it clear that what’s at stake is not just who gets to stay here but also the whole idea of American sovereignty and the rule of law. What was once a problem that could have been solved with enough goodwill and patience has turned into an intractable battle line in a cultural civil war.

So long as Democrats insist the United States is the only nation not entitled to defend its border or to enforce its immigration laws, any long-term immigration fix will remain beyond reach.

Jonathan Tobin is editor in chief of JNS.org and a contributing writer for National Review. Twitter: @JonathanS_Tobin