It may seem impossible, but a compromise can end the U.S. government shutdown, now in a fifth week when nearly 800,000 unpaid federal workers would otherwise be expecting a paycheck. Democrats should start negotiating with President Donald Trump after his weekend proposal to offer more protections for some 700,000 individuals in the Deferred Action for Childhood Arrivals (DACA) program in exchange for $5.7 billion in border wall funding. Trump also proposed $800 million for urgent humanitarian assistance and $563 million to beef up the immigration court system, including hiring 75 new immigration judges to reduce a backlog of asylum seekers crossing the southern border.

Democratic criticism of Trump’s proposal was predictably hasty, if spot-on. Holding federal workers hostage in a policy fight is callous. And protections for DACA “dreamers” must be written into federal law, not set by legally flimsy executive order.

That’s a key point. The president’s offer of three years of legal protections for the roughly 700,000 individuals in the DACA program doesn’t provide anything close to the “certainty to people’s lives” that House Speaker Nancy Pelosi, D-San Francisco, said was essential. It’s easy to grasp why President Barack Obama decided to give work permits to these “dreamers” — migrants brought to the United States illegally as children who are leading productive and constructive lives — and allow them to stay in the nation. It’s also worth noting that the U.S. Supreme Court on Tuesday declined to green-light the Trump administration’s 2017’s decision to scrap DACA, letting stand lower-court rulings that blocked the decision. Going forward, DACA protections must be law, not revocable regulations.

But Pelosi’s categorical rejection of Trump’s proposal and her assertion that a border wall is “immoral” are counterproductive. As are Democrats’ bizarre claims that walls don’t work. There may be better ways to spend federal money on border security, but the 14-mile fence between Tijuana and San Diego that was built in the 1990s drasticallyreduced the number of illegal border crossings. More recently, construction of a border wall in the Yuma, Arizona, area had the same effect. Walls put up by Israel, Egypt and Spain have also been effective.

Democrats should concede this point even if Trump complicates it. Perhaps because of his rhetoric, American support for a wall has wavered since 2015. But if he allows protections for DACA members to be written into law, then allowing miles of fencing or barriers to be built in areas in Texas and other states that are heavily crossed is reasonable.

This should not be read as countenancing Trump’s shutdown strategy or ignoring the stark, ugly nativism of his border “invasion” rhetoric. Instead, it’s a call for Congress to do its job and send Trump a bill he’d be foolish to veto, one that ends the shutdown with a compromise or buys time to make an immigration deal. Free the federal workers.