It was late on a Thursday afternoon in the marbled halls of the Senate, and a small group of negotiators — one Republican, one Democrat and one independent — had just about finished a painstakingly put together border security compromise it took them months to forge.

But what should have been a triumphant moment felt more like an ordeal for the lone Republican in the trio.

“I feel like the guy standing in the middle of the field in a thunderstorm, holding up the metal stick,” Senator James Lankford, the Oklahoma Republican who was his party’s lead broker of the deal, told reporters last week.

The plight of Mr. Lankford, a slim, understated Baptist minister with a neatly combed shock of red hair and a baritone voice that regularly delivers deadpan quips, reflects the extraordinary rise and fall of the border and Ukraine deal that is expected to collapse in a test vote in the Senate on Wednesday — and the political forces within the Republican Party that brought it down.

For months, Mr. Lankford, a staunch conservative, labored over the package alongside Senators Christopher S. Murphy, Democrat of Connecticut, and Kyrsten Sinema, an Arizona independent, demanding strict immigration policies his party insisted must be a part of any bill to send a fresh infusion of aid to Ukraine. But when Mr. Lankford managed to extract them, he found his fellow Republicans unwilling to embrace the plan, in a vivid illustration of how the political ground for any compromise on immigration has vanished for a party that has decided the issue is too valuable as a political weapon to resolve.