Mr. Trump reacted angrily on Sunday. In a Twitter post, he seemed to give immigration lawyers and advocates reason to fear that the country may not remain open for long to refugees, or to visa holders from the seven nations — Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen.

“I have instructed Homeland Security to check people coming into our country VERY CAREFULLY. The courts are making the job very difficult!” he wrote.

Mr. Doyle said that between Monday and Feb. 17, about 2,000 refugees would be rebooked on flights to the United States. Those who were expected to leave first had moved out of their apartments or refugee camps, sold their belongings and turned in their food ration cards.

In Kenya, dozens of Somalis who had cleared all the final security and medical checks to enter the United States were waiting on Sunday in the refugee camp, where they were told that they might be able to travel in the next few days. But they were no longer sure who — or what — to believe.

“I feel completely ruined,” said Ahmed Hassan, a Somali refugee heading for Rhode Island. In the past few weeks, Mr. Hassan was bused out of the camp; sent to a transit center in Nairobi, Kenya’s capital, several hundred miles away; given travel documents; told he was about to fly to America; told he was not about to fly to America; bused back to the camp; and then told he might actually fly to America after all. He boarded a bus in Nairobi to return to the camp just hours before the federal judge lifted the travel ban.

Mr. Hassan had sold his home and feared that he could be targeted as an American sympathizer by the Islamist and anti-American militants known to move in and out of the camps. He had arrived back at the refugee camp on Saturday afternoon, retreated from the crowds shouting questions at him and hid inside a room.