DADAAB REFUGEE CAMP, Kenya

Her friends were rushing to say goodbye. They gathered in the sliver of shade outside her mud hut, next to the pile of bags packed with everything Khairo Hassan had accumulated as a refugee.

“I’m going to miss you,” said one woman, who kissed her cheeks.

“We hope you are safe there,” said a girl who hugged her, while Hassan’s eyes filled with tears.

In three days, Hassan, 44, would be leaving this sprawling refugee camp for Mogadishu, Somalia, one of the most dangerous cities on the planet, with two of her daughters and her granddaughter. She hated the idea. Every week, it seemed, Islamist extremists there grew more brazen. In October, a truck bomb had killed 512 people, one of the deadliest terrorist attacks anywhere since Sept. 11, 2001.

Hassan was traveling through a U.N. program called “voluntary repatriation,” which provides hundreds of dollars to refugees in Kenya who choose to go back home. But there was nothing voluntary about her journey to Somalia.