By Peter Baker–

Travelers were stranded around the world, protests escalated in the United States and anxiety rose within President Trump’s party on Sunday as his order closing the nation to refugees and people from certain predominantly Muslim countries provoked a crisis just days into his administration.

The White House pulled back on part of Mr. Trump’s temporary ban on visitors from seven countries by saying that it would not apply to those with green cards granting them permanent residence in the United States. By the end of the day, the Department of Homeland Security formally issued an order declaring legal residents exempt from the order.

But the recalibration did little to reassure critics at home or abroad who saw the president’s order as a retreat from traditional American values. European leaders denounced the order, and some Republican lawmakers called on Mr. Trump to back down. As of Sunday evening, officials said no one was being held at American airports, although lawyers said they believed that dozens were still being detained.

More than any of the myriad moves Mr. Trump has made in his frenetic opening days in office, the immigration order has quickly come to define his emerging presidency as one driven by a desire for decisive action even at the expense of deliberate process or coalition building. It has thrust the nine-day-old administration into its first constitutional conflict, as multiple courts have intervened to block aspects of the order, and into its broadest diplomatic incident, with overseas allies objecting.

The White House was left to defend what seemed to many government veterans like a slapdash process. Aides to Mr. Trump insisted they had consulted for weeks with relevant officials, but the head of the customs and border service in the Obama administration, who resigned on inauguration day, said the incoming president’s team never talked with him about it.

White House officials blamed what they portrayed as a hyperventilating news media for the confusion and said the order had been successfully carried out. Only about 109 travelers were detained in the first 24 hours, out of the 325,000 who typically enter the United States in a day, they said. As of Sunday evening, the Department of Homeland Security said 392 green card holders had been granted waivers to enter. That did not count many visitors who remained overseas now unable to travel.

Reince Priebus, the White House chief of staff, said Mr. Trump simply did what he had promised on the campaign trail and would not gamble with American lives. “We’re not willing to be wrong on this subject,” he said on “Face the Nation” on CBS. “President Trump is not willing to take chances on this subject.”

The order bars entry to refugees from anywhere in the world for 120 days and from Syria indefinitely. It blocks any visitors for 90 days from seven designated countries: Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen. The Department of Homeland Security initially said the order would bar green card holders from those seven countries from returning to the United States.

With thousands of protesters chanting outside his White House windows and thronging the streets of Washington and other cities, Mr. Trump late on Sunday defended his order. “To be clear, this is not a Muslim ban, as the media is falsely reporting,” he said in a written statement. “This is not about religion — this is about terror and keeping our country safe.”

He noted that the seven countries were identified by former President Barack Obama’s administration as sources of terrorism and that his order did not affect citizens from dozens of other predominantly Muslim countries. “We will again be issuing visas to all countries once we are sure we have reviewed and implemented the most secure policies over the next 90 days,” he said.

Mr. Trump expressed sympathy for victims of the long-running civil war in Syria. “I have tremendous feeling for the people involved in this horrific humanitarian crisis in Syria,” he said. “My first priority will always be to protect and serve our country, but as president, I will find ways to help all those who are suffering.”

While Mr. Trump denied that his action focused on religion, the first iteration of his plan during his presidential campaign was framed as a temporary ban on all Muslim visitors.

As late as Sunday morning, he made clear that his concern was for Christian refugees, and part of his order gives preferential treatment to Christians who try to enter the United States from majority-Muslim nations.

In a Twitter post on Sunday morning, Mr. Trump deplored the killing of Christians in the Middle East without noting the killings of Muslims, who have been killed in vastly greater numbers in Iraq, Syria and elsewhere.

“Christians in the Middle East have been executed in large numbers,” he wrote. “We cannot allow this horror to continue!”

His order, however, resulted in a second day of uncertainty at American airports. The American Civil Liberties Union said it was investigating reports that officials were not complying with court orders in New York, Boston, Seattle, Los Angeles and Chicago.

New York’s attorney general sent a letter to federal authorities demanding a list of all individuals detained at Kennedy International Airport. The Department of Homeland Security said on Sunday evening that it was “in compliance with judicial orders.”

Still, at Dulles International Airport outside Washington, even the arrival of four Democratic members of Congress did not prompt customs officers to acknowledge whether they were holding anyone or provide lawyers access to anyone detained.

The lawmakers arrived after 3 p.m. and were rebuffed by police officers when they tried to enter the Customs and Border Protection offices at the airport. Representative Gerry Connolly, Democrat of Virginia, said he was told to call the main office of the agency in Washington.

His staff got a legislative liaison from the customs service on the phone, and “they said we’ll put you in touch with the deputy commissioner,” Mr. Connolly said.

“I said that’s not acceptable,” he continued. “We want to talk to the person in charge of operations at Dulles Airport. That’s where the problem is, and that’s where the federal judicial ruling is applicable.”

The clash over the order provoked emotional responses. At a news conference, Senator Chuck Schumer, the Democratic minority leader from New York, choked up as he vowed to “claw, scrap and fight with every fiber of my being until these orders are overturned.”

The mayors of New York, Chicago and Boston spoke out, as well. In Dallas, Mayor Mike Rawlings personally offered regrets to four released detainees at Dallas-Fort Worth Airport. “We have wished them welcome, and we have apologized from the depths of our heart,” he said. Chelsea Clinton joined a protest in New York.

The order roiled relations with America’s traditional allies in Europe and the Middle East. The spokesman for Chancellor Angela Merkel of Germany said she “is convinced that the resolute fight against terrorism does not justify blanket suspicion on grounds of origin or belief.”

Prime Minister Theresa May of Britain, who met with Mr. Trump in Washington on Friday and has sought to forge a friendship with him, initially declined to comment on the policy on Saturday when pressed by reporters during a stop in Turkey.

But under pressure from opposition politicians, her spokesman later said the British government did “not agree with this kind of approach.”

The matter was especially sensitive in Muslim countries, and Mr. Trump spoke by telephone on Sunday with King Salman of Saudi Arabia and Sheikh Mohammed bin Zayed Al Nahyan, the crown prince of Abu Dhabi. White House statements on the calls said they discussed the fight against terrorism but did not say whether they discussed the immigration order, which did not include their countries.

In Washington, protesters gathered by the thousands outside Mr. Trump’s front lawn to denounce his order and show solidarity with Muslim Americans.

“Shame,” they chanted, hoisting homemade signs toward the executive mansion, where Mr. Trump was scheduled to host a private screening of the movie “Finding Dory.”

“No hate, no fear,” they added later. “Refugees are welcome here.”

Security fencing and reviewing stands still in place from the inauguration prevented the crowd from getting more than a couple hundred yards away from the building, but did not stop crowds from swelling through the afternoon, when protesters departed to march to Capitol Hill.

Some Republicans grew increasingly alarmed by the backlash to the order. “This executive order sends a signal, intended or not, that America does not want Muslims coming into our country,” Senators John McCain of Arizona and Lindsey Graham of South Carolina said in a statement. “That is why we fear this executive order may do more to help terrorist recruitment than improve our security.”

Some conservative donors also criticized the decision. Officials with the political network overseen by Charles G. and David H. Koch, the billionaire conservative activists, released a statement on Sunday criticizing Mr. Trump’s handling of the issue.

“We believe it is possible to keep Americans safe without excluding people who wish to come here to contribute and pursue a better life for their families,” said Brian Hooks, a chairman of the Kochs’ donor network. “The travel ban is the wrong approach and will likely be counterproductive.”

Senator Bob Corker, the chairman of the Foreign Relations Committee, said the order was “poorly implemented” and urged the president to “make appropriate revisions.” Other Republicans were more circumspect. Senator Mitch McConnell, the Republican majority leader, said the issue would be decided by the courts.

Mr. Trump fired back at Mr. McCain and Mr. Graham on Twitter. “They are sadly weak on immigration,” he wrote. “Senators should focus their energies on ISIS, illegal immigration and border security instead of always looking to start World War III.”