After nearly two months of presidential grandstanding and partisan finger-pointing, not to mention 35 days of a partial government shutdown that accomplished nothing, it seems that even Republican lawmakers have had enough of Mr. Trump’s posturing.

Heading into this round of haggling, both sides committed to digging in, making concessions and arriving at a deal that could pass both chambers. They committed, in other words, to actually legislating. If the president couldn’t stomach the final product, well, that was his choice. But, in this matter at least, the Senate Republican leader, Mitch McConnell, appears to be done protecting Mr. Trump from tough choices.

Looking beyond the wall for a moment, the emerging deal is sufficiently complex to allow both teams to claim partial victory — in some cases over the same provision. Democrats, for instance, are boasting of having cut the number of “detention beds” to be funded, from the current level of 49,000 down to 40,000, with a path toward further reductions. For their part, Republicans are contending that, thanks to flexibility in how departments use their funding, the budget would actually allow for 45,000-plus beds, with an eventual increase to more than 58,000.

When it comes to the heart of this fight, however, there is no ambiguity. Democrats stayed unified and denied Mr. Trump his $5.7 billion. Republicans determined that the cost of continuing the battle was too steep. Congress, like Mexico, will not pay for Mr. Trump’s wall.

The president’s conservative fan base was quick to pounce. On Monday night, the Fox News host Sean Hannity, one of the pro-wall die-hards who goaded the president into rejecting a funding deal in December, warned, “Any Republican that supports this garbage compromise, you’ll have to explain.”