Mr. Ibrahim was much closer than most — so close that, with his ticket, paperwork and bag all zipped up, the thought of it made his voice quiver. He had waited 26 long years for this, living in a sweltering, crowded, disease-ridden refugee camp along the Kenya-Somalia border that is the opposite of hope.

Now his worst fears are shaping up. The Somali refugees who had already been extensively vetted and approved by several American government agencies will most likely be bused back to the camps. Many said that they feared for their lives and that their situation was actually worse than it had been before they came so close to leaving.

“Trump shocked us,” Mr. Ibrahim said.

Most of them are now broke, having just two weeks ago given away their worldly possessions in a spree of happiness to friends less fortunate. But more worrisome, many refugees said as they gathered under the shade of a mango tree at the transit center, was the risk that they could be labeled “friends of America.” That’s a dangerous tag in a poorly policed refugee camp crawling with Islamic militants.

“The Shabab will be suspicious of us,” said Deck Abdi Korriyow, another refugee, referring to the militant group that has slaughtered thousands of people across eastern Africa. “They don’t want anyone resettled to the U.S. They’ll think we’ve been giving information to the Americans.”

Several men around him vigorously nodded when he added, “Who knows what will happen to us next?”

Kenya is home to hundreds of thousands of Somali refugees and many are treated terribly — constantly harassed, arrested, often beaten, discriminated against, kept in large camps or locked in a soccer stadium during police roundups, and sometimes they have even disappeared. Many Kenyans see Somalia the way much of the world does: as a terrorist threat.