The knock on Democrats over the years is that they have grand and costly goals often foiled by unintended consequences.

The debate over welfare, for instance, has long been on how to help poor people who need assistance to get back on their feet. And yet it was a Democratic president, Bill Clinton, who took heat from the left for imposing limits so the program wouldn’t endlessly foster dependency with no incentive to work.

The party has moved sharply left since those 1990s battles, and even since the Obama years, but still fashions itself as the champions of compassion in contrast to the hard-hearted Republicans. That’s why President Biden hit the road yesterday to sell the stimulus checks, jobless benefits, vaccine support and school aid in the Covid relief law, while the GOP eviscerates such unrelated provisions as bailing out union pension plans.

But at the border, Biden has run into, excuse the expression, a brick wall.

His policies have created a crisis, even if the White House dislikes that word, and there’s no easy way out. What’s more, the president has handed the Republicans a powerful political weapon. And they are wielding it, perhaps realizing that denouncing a relief bill with 70 percent popularity is not the way to return to power.

There is ample hypocrisy on both sides. But even the media, which rose up in moral condemnation of Donald Trump’s immigration policies, are recognizing the magnitude of the problem and starting to hold Biden accountable.

First it was the New York Times revealing a tripling of migrant children coming across the Texas border and no adequate facilities for these more than 3,000 kids. Then the Associated Press said hundreds of them, despite Covid, were being housed in a packed tent, with some having to sleep on the floor.

CUOMO WON'T GO: WHEN POLITICIANS TRY TO PRESSURE AN ALLY INTO RESIGNING

As the Washington Post put it yesterday: "Nearly two months into his first term, Biden faces a growing political threat from the upheaval at the border and is drawing criticism from across the spectrum. Centrist Democrats are nervous about attacks casting them as soft on border security. Liberals and immigration activists are sounding alarms about how migrants are treated. And Republicans are increasingly laying the groundwork for immigration-centric attacks in the midterm elections."

The first signal that Biden sent, proposing comprehensive immigration reform, including a path to citizenship, made clear he was breaking with Trump’s approach. The second, more concrete signal is that the new administration started letting more migrants into Texas to pursue their asylum claims, rather than the Trump method of turning them away.

As the Post explained, "Biden officials have attempted to counter smugglers’ claims with statements from the White House insisting that the border is closed and that anyone crossing it will not be allowed in — but those statements don’t entirely reflect the reality."

A former Obama customs commissioner is quoted as saying that "in fact, for unaccompanied children and families with children under 6, the border is open."

To be sure, Biden is not adopting the early Trump policy of separating migrant kids from their parents, which caused so much damage. But many minors now arrive unaccompanied. And it’s the more "humane" approach that is being seen by impoverished families and profiteering smugglers as a green light to head to America. That was predictable, and little planning was done for dealing with the resulting surge, which is why Biden has had to call in FEMA.

Kevin McCarthy, the House minority leader, went to the border this week. He declared that "the security of our nation and our border is first and foremost the responsibility of our president" and called the situation "more than a crisis — this is human heartbreak."

Now if McCarthy spoke out against the Trump policies that caused heartbreak at the border, I don’t remember it.

But the same selective outrage applies to Democrats who trashed Trump over the border and are making excuses for Biden’s debacle.

But progressive Democrats like AOC have been highly critical on humanitarian grounds, seeing little difference between Trump’s "kids in cages" and Biden’s kids in tents.

Even a moderate Texas Democrat, Henry Cuellar, told the Post that Biden’s people "need to do a better job of listening to those of us who have done this before," and that the GOP can now portray his party as "weak on the border."

SUBSCRIBE TO HOWIE'S MEDIA BUZZMETER PODCAST, A RIFF OF THE DAY'S HOTTEST STORIES

Look, if illegal immigration wasn’t such an intractable problem, it would have been fixed long ago. Trump, Barack Obama and George W. Bush all failed to get immigration legislation passed, and there may be even less hope with today’s increasingly polarized parties.

But it is a potent issue, as Democrats learned to their dismay in 2016. Many Americans resent illegal immigrants for taking jobs (though much of it is undesirable work) and drawing government benefits, and those who commit crimes get outsized attention. Yet even Trump made no serious effort to deport the 11 million people in this country illegally.

Biden undoubtedly views himself as a humanitarian trying to do the right thing. But that doesn’t insulate him from criticism that his more compassionate approach has so far turned out to be the wrong thing.