This post has been updated with the latest news.

By separating families at the border, President Trump couldn't have handed Republicans in Congress a more politically perilous situation to deal with if he tried. And just as Republicans in Congress had decided to stick their necks out to fix his manufactured crisis, Trump pulled the plug on everything.

He indicated Wednesday he'll do what Democrats and some Republicans have been asking him to do all along: Pick up his pen and end his administration's weeks-old and incredibly controversial policy of separating families at the border. His announcement came just as Republican leaders in Congress were trying to pass legislation to end the policy themselves.

You could argue Trump just gave Republicans a break. Less than five months before an election where they could lose one or both chambers, Trump was forcing them to deal with the last thing they want to touch right now: immigration. Now, they may not have to.

But Trump also left Republicans hanging on whether they should take politically risky votes Thursday to protect undocumented immigrants brought to the country as children, known as “dreamers.” Protecting them from deportation was the original reason for the two bills proposed in the House. As the border-separation crisis escalated, ending the president's policy had been a main driver for Republicans to vote on legislation. Lawmakers in Congress almost universally oppose the president's policy, and a notable number have been calling him out all week on the fact that he can end it.

Republican leaders decided to play Trump's game and draft legislation. Not helping things: Trump has been extremely inconsistent and vague about which House bill Republicans should support. Of the two, he torpedoed the one that has a chance of getting a majority of Republicans on board, then offered Republicans no more clarity this week.

“He didn’t really tell us what bill to vote for,” Rep. Markwayne Mullin (R-Okla.) told Washington Post reporters after Trump met with lawmakers at the Capitol on Tuesday.

So do they try to vote on immigration or drop it? Like much of Trump's presidency, no one in Congress has any idea what's going on, what could happen next and whether Trump will offer Republicans in Congress political cover for trying to fix his problems — or turn on them in a tweet that could cost them their jobs.

Even the subject at hand, immigration, is the last thing Republican leaders in Congress wanted to be dealing with right now. House Speaker Paul D. Ryan (R-Wis.) quashed an uprising by moderate Republicans to hold a vote just on protecting dreamers, fearful that it would pass with the help of Democrats. That would not be a good look for a Republican-controlled Congress hoping to ramp up its base's enthusiasm for November.

The whole reason moderate House Republicans were taking extraordinary steps to get such a vote in the first place? Trump. He ended dreamer protections in the fall — although their status is now held up in courts — and tossed it to Congress to deal with.

But Trump doesn't seem concerned about dreamers right now. He used their status as a negotiating chip to try to get funding for his border wall in the spring, and when that failed, he tried to use his policy of separating families at the border as a negotiating chip for his wall.

Trump blinked first on border separation. But he did it just as legislators were preparing to take their first major steps in years to overhaul the immigration system, and vote on a bill that would have given $25 billion for his wall. And he left them totally uncertain about what to do next.

All of this combined ranked up there as one of Republican leaders' worst legislative nightmares. And it was entirely manufactured by Trump, who is — purposefully or not — sabotaging on a near-daily basis Congress's efforts to fix the problems he created.