President Trump debates with House Minority Leader Nancy Pelosi (D-Calif.), left, and Senate Minority Leader Charles E. Schumer (D-N.Y.), right, as Vice President Pence listens during a meeting in the Oval Office of White House on Dec. 11. (Jabin Botsford/The Washington Post)

PUT ASIDE Tuesday’s Oval Office theatrics and remember this: There’s a compromise within reach on the wall and immigration for President Trump and congressional Democrats — if each side has the spinal fortitude to face down its own most rabid partisans and take it.

For Mr. Trump, the art of this deal should be easy to grasp. To secure funding for his wall, he should offer a path to legal status or citizenship for more than 1 million “dreamers” — mainly undocumented immigrants in their teens and 20s brought to this country by their parents and raised here since childhood — a stance that is broadly popular with voters across the political spectrum. Sweeten that with continued safe harbor in the United States for some 300,000 Hondurans, Haitians and Salvadorans who have already been living here for years, legally, having been granted temporary protected status after calamities struck their home countries, and the president could lure plenty of Democrats to the table, ready to discuss his border wall.

Granted, funding the wall, even in stages, is distasteful to lots of Democrats; Rep. Nancy Pelosi (D-Calif.), the likely next House speaker, has called it “immoral.” But many in the party have supported past efforts to bolster security along the border — more Border Patrol agents, more technology and more infrastructure, including, yes, barriers.

The wall as Mr. Trump imagines it may be wasteful overkill, but it’s a stretch to frame it as a moral issue, as Ms. Pelosi does. The initial funding the president seeks, $5 billion, is hardly a break-the-bank sum by Washington standards — especially given that Democrats are already prepared to offer $1.6 billion for border security. And even if funds for a wall were appropriated, construction would immediately be challenged by ranchers and other property owners along the border, who could tie it up in court.

If there is a moral imperative in any trade-off involving immigration and security, it’s the urgent necessity of finding a way to ensure a future in this country for dreamers, who are Americans by upbringing, education, loyalty and inclination — by every metric but a strictly legal one. Striking a deal that achieves that outcome should be a no-brainer for both sides. If it means a few billion dollars to construct segments of Mr. Trump’s wall, Democrats should be able to swallow that with the knowledge that it also will have paid to safeguard so many young lives, careers and hopes. That’s not a tough sell even in a Democratic primary.

Any compromise worth the trouble involves painful concessions for each side, but in this case, if assessed with cool heads, the concessions are a far cry from excruciating. The question, for both sides, is familiar: Do they want an issue or a solution? If it’s the latter, it’s eminently achievable.