WASHINGTON — Washington moves slowly except in times of crisis — political crisis that is.

Beleaguered Republican members of Congress breathed a momentary sigh of relief on Wednesday after President Trump suddenly relented and took steps to stop the separation of immigrant children from their parents after they illegally entered the country along the southern border.

With the midterm elections less than six months away, Republicans trying to hold their majorities in the House and Senate were desperate for quick action that would bring an end to heartbreaking images of crying toddlers who had been taken from stunned parents. They were well aware that the situation was inciting public outrage at a level that threatened to oust some Republican lawmakers from their congressional seats come November.

“America is better than this inhumane, anti-family zero-tolerance policy,” the office of Senator Orrin G. Hatch of Utah, the senior Republican in the Senate, declared again in a tweet on Wednesday morning, hours before the president announced his retreat.

But Republicans are not out of the woods yet. The president’s grudging executive order, which took a shot at Congress for its “failure to act,” is likely to be only a temporary respite in the standoff over immigration. Congress is still struggling to resolve myriad issues, including the fate of undocumented immigrants brought into the country as children, as well as Mr. Trump’s demand for $25 billion to build a wall along the southwestern border, with the House facing a series of difficult votes Thursday on the immigration question.