Image copyright Reuters Image caption History will have its own take on President Trump's immigration order

It's only one week into Donald Trump's presidency, and he already has his first "heckuva job" moment.

For those who don't remember, in the aftermath of Hurricane Katrina in 2005, President George W Bush publicly praised his emergency management head, Michael Brown, for doing a "heckuva job" with recovery efforts.

That comment was hung around the president's neck like an anvil, as flood waters swamped parts of New Orleans and the city descended into chaos. It started a public approval downward spiral that led to sweeping Democratic victories in the 2006 mid-term elections.

History will judge the long-term impact of Mr Trump's Friday afternoon immigration order, but his early praise for its implementation will not easily be forgotten.

Media playback is unsupported on your device Media caption Protesters shouted "let them in" at demonstrations in JFK Airport in New York

"It's working out very nicely," Mr Trump said in a brief response to a question on Saturday afternoon. "You see it in the airports, you see it all over. It's working out very nicely, and we are going to have a very, very strict ban, and we are going to have extreme vetting, which we should have had in this country for many years."

On the ground at major US airports, things weren't going quite so nicely, however. Immigration officials were having a difficult time implementing Mr Trump's order after receiving conflicting instructions on who to bar from entry into the US - and what to do with them once they were held. And as the day progressed, and word spread of the detentions, crowds of protesters at international terminals grew from dozens to hundreds to thousands.

While on the campaign trail, it was easy for Mr Trump to roundly decry the US immigration system as broken and make a general call for bans and moratoriums. As president, however, his team has had to fill in the details - and it seems they faced some difficulty translating his pre-election rhetoric into policy.

Mr Trump's Friday afternoon executive order reportedly was crafted without consulting legal aides and enacted over the objection of homeland security officials, who balked at including permanent US residents in the ban.

Media playback is unsupported on your device Media caption President Trump: "It's not a Muslim ban, but we're totally prepared"

This made for an awkward scene Saturday night at a New York courthouse, where government attorneys had to defend measures that were creating chaos at airports across the nation.

"I think the government hasn't had a full chance to think about this," said federal judge Ann Donnelly, as she ruled that individuals with valid paperwork on US soil couldn't be deported.

Her temporary ruling - and those like it in other courts - are only the opening salvo in what will likely be a protracted legal battle. Trump administration lawyers will surely be better prepared in future hearings. The orders could be re-instated following full trials on the merits, and no judge has yet to rule on the fate of individuals who hold valid US visas and are still on foreign soil.

In the meantime, however, this has proven to be an embarrassing episode in what looks like a not-ready-for-primetime White House.

Image copyright Reuters Image caption At a New York courthouse, a judge issued a stay blocking the deportation of travellers who arrive in the US with valid visas

A handful of Republicans in Congress have come out with varying levels of objection to the programme, and although the Republican leadership is playing along for the moment, that could change quickly if the political heat increases. The president may have broad powers in setting immigration policy, but Congress can pass legislation that overrules him at any time.

Meanwhile, Democrats are scrambling to take advantage of the political opportunity.

"History will judge where America's leaders stood today," Democratic Senator Dick Durbin of Illinois said. It was a warning some of his party's 2020 presidential contenders seemed to take to heart.

Image copyright Reuters Image caption Senator Elizabeth Warren greets demonstrators protesting against the executive order at Boston's Logan Airport

New York Governor Andrew Cuomo ordered airport trains to resume service to JFK Airport, after transit officials had suspended service to prevent protesters from continuing to flood in. Senator Elizabeth Warren spoke to crowds at Boston's Logan Airport, as did Senator Cory Booker at Dulles near Washington, DC.

All three are considered near the top of the Democratic presidential field.

2020 is a long way off, of course. Of more pressing concern is where the Trump administration goes from here.

On Sunday morning, press secretary Sean Spicer, chief of staff Reince Priebus and top aide Kellyanne Conway took to the airwaves to defend the White House policy and explain its implementation.

Mr Trump himself fired back on Twitter - although only after first taking a swipe at the "failing" New York Times for the second day in a row.

"Our country needs strong borders and extreme vetting, NOW," he tweeted. "Look what is happening all over Europe and, indeed, the world - a horrible mess!"

Media playback is unsupported on your device Media caption "I feel he has a reason for doing what he's doing" said one Staten Island resident

While championing US security is usually a winning issue, protracted detention of children and the elderly at airport checkpoints is "bad optics", as they say. Watching a five-year-old re-united with his mother and 70-year-olds facing indefinite detention puts a human face on Mr Trump's immigration programme - and the results aren't flattering for the White House.

During the presidential primary, a majority of Republican voters backed Mr Trump's calls for a sweeping ban on Muslims entering the US, so the president's core support may hold firm after this weekend's events. The views in the American heartland, far removed from major international airports, sometimes differ greatly from the liberal bastions on the coast.

At best, however, this is an unnecessary distraction for the White House, calling its organisational ability into question. At worst - if the majority of the nation turns on the president - Mr Trump may find his power and influence starting to ebb before his administration even gets fully under way.