As a crisis of migrant children separated from their families provoked national outrage, President Donald Trump said he was powerless to act through an executive order. Five days later, he did just that. The president's abrupt about-face laid bare the administration's capricious use of executive power as it presses forward with a crackdown on illegal immigration, first ensnaring children in its 'zero tolerance' prosecution policy, then coming up with a 'stopgap' reprieve in the face of global condemnation. The president who had declared as a candidate that 'I alone can fix' the nation's problems in recent weeks threw up his arms and said only Congress could solve the problem of children being separated from their parents — and then reversed course once again. What changed? Brookings Institution senior fellow Bill Galston, a presidential scholar and a Clinton White House official, described it as 'classic blame shifting' in the face of mounting bipartisan criticism and amid heartbreaking tales of toddlers kept from their parents. The president, he said, was in an 'unsustainable position and would like to be bailed out of it without having to admit fault.' White House officials, advocates and congressional leaders were blindsided Wednesday when word emerged that Trump was considering doing precisely what he'd forcefully claimed he couldn't do — act unilaterally to quell a growing humanitarian and political crisis. The four-page order he signed will keep together children and parents apprehended for crossing the border illegally for at least 20 days, and directs the Justice Department to fight in court to permanently remove the threat of separation. Trump acted after encountering mushrooming blowback from Democrats, Republicans, evangelical leaders, former first ladies — even the pope. But White House officials offered little explanation for the reversal or why the president didn't act sooner. It was a rare public step-down from the president in the face of a monumental self-imposed crisis. 'I didn't like the sight or the feeling of families being separated,' Trump said. Family separations soared after the Justice Department's April announcement that all unlawful border crossings would be criminally prosecuted set in motion what officials described alternately as a predictable chain of unintended consequences, or a deliberate effort to pressure Congress to finally enact the president's immigration priorities. As distressing images and audio of bereft children emerged, Trump found himself lobbied privately by his wife and eldest daughter to do more. 'The first lady has been making her opinion known to the president for some time now,' a White House official said, 'which was that he needed to do all he could to help families stay together, whether it was by working with Congress or anything he could do on his own.' The official spoke on the condition of anonymity to describe her thinking. White House spokesman Raj Shah said Ivanka Trump had phoned lawmakers on Capitol Hill to echo the president's call to pass legislation to solve the issue completely. Homeland Security Secretary Kirstjen Nielsen, who became the face of the family separations with her combative press briefing Monday, began to have second thoughts of her own. On Monday evening, she faced protesters at her home. On Tuesday, she was heckled out of a Mexican restaurant. Alumni of her Berkeley, California, high school circulated an open letter of condemnation. Nielsen pushed the president to find a way to de-escalate the situation, said two officials, who were not authorized to describe the discussions and requested anonymity. That came in the form of the executive order, which Justice Department lawyers had drafted in the days earlier in case the president should want that option. Wednesday morning, he ordered attorneys to get it ready for his signature. The order stated: 'It is also the policy of this Administration to maintain family unity, including by detaining alien families together where appropriate and consistent with law and available resources.' But despite the presidential pomp — Trump gave Nielsen the marker he used to sign the order — the president's action is unlikely to completely fix the problem. It would keep children detained together with their parents as they await criminal prosecution and deportation, potentially indefinitely. The more than 2,000 children who already have been moved to the care of the Department of Health and Human Services won't be immediately reunited with family members. And a top Justice Department official, Gene Hamilton, described the order as a 'stopgap' fix to give the courts or Congress time to overturn the 20-day limitation on the detention of children in Department of Homeland Security facilities. If neither branch acts within 20 days, newly detained families may again be separated. On Capitol Hill, Republican leaders were caught off-guard by Trump's sudden reversal, according to senior GOP aides who were granted anonymity because they were not authorized to discuss the matter by name. House Speaker Paul Ryan heard about it as he was taking wayward GOP lawmakers to a midday meeting with Trump at the White House to cajole them to vote for a sweeping immigration bill. House Majority Leader Kevin McCarthy's office learned about it from an Associated Press news alert just before the Californian and his staff gathered for their daily meeting. Trump's decision came as Republicans in the House had hoped they were on the verge of bridging internal divisions to pass a wide-ranging election-year immigration bill to provide deportation protections for so-called Dreamers and funding for Trump's border wall. White House legislative officials watched as the president's action threatened a delicately negotiated balance between conservative and moderate House Republicans. A so-called compromise bill between GOP factions had been teetering on brink of collapse ever since it was introduced last week. Trump had largely stayed on the sidelines of the talks but inserted himself Friday morning when he told reporters at an impromptu press conference he would not sign it. GOP leaders quickly convinced Trump to reverse course and hours later he tweeted his support. Arrangements were made for a quick Trump visit to Capitol Hill late Tuesday to reinforce his endorsement. And as the crisis at the border escalated, House GOP leaders added a provision to address the family-separation matter. But when Trump visited with House Republicans on Tuesday, he spent considerable time showcasing unrelated accomplishments, recognizing his supporters and mocking his political opponents. He did call on Congress to alleviate the plight of the separated children — but reiterated that his hands were tied. ___ Associated Press writers Lisa Moscaro, Jill Colvin and Colleen Long contributed to this report.