Gaza is perhaps the best example of this. The eight original refugee camps have morphed into towns that, together, are now one of the most densely populated areas in the world, home to 1.7 million people. Separate from the U.N.H.C.R. and with a different mandate, the United Nations Relief and Works Agency for Palestine Refugees in the Near East was founded in 1949 for around 750,000 Arab Palestinians forced to flee their homes in 1948. But with no peace deal or return in sight, the agency looks after their five million descendants at a cost to the international community of over $1 billion a year. The agency was supposed to be an exception, but Gaza now looks like the rule. In Dadaab, the United Nations resettles around 2,000 refugees annually to Europe, Australia, Canada and the United States. But the birthrate in the camp of 1,000 a month will always outstrip that effort.

As refugee populations spiral higher, host nations usually move toward ever stricter encampment policies. Kenya is one of the strictest; last year the police rounded up thousands of refugees found outside designated camps and incarcerated them in the national stadium. Pakistan has threatened several times not to renew refugee status for Afghan refugees, and periodically attempts to force people back to Afghanistan. In Jordan, refugees have the right to move and work in theory, but authorities have reportedly issued no new work permits since 2014 and have begun coercive administrative measures to keep them in the camps.

To leave Dadaab, residents require a “movement pass,” just like under apartheid. Acquiring one usually involves a bribe. Thus, members of the third generation that is now beginning life in Dadaab may well spend their whole life in the camp. If they win one of the fiercely contested slots at secondary school, they could gain diplomas and degrees online or through the mail, but when there’s no viable path to a free future elsewhere, education in the closed camp is a cruel trick: There are no jobs except volunteer positions with the aid agencies that run the hospitals, schools and social programs, and these pay a fraction of what Kenyan staff members receive for doing the same job.

One might expect that in such circumstances, talent would curdle into bitterness, but the most striking thing about Dadaab is that the miserable conditions do not seem to have engendered radicalization. People are frustrated, but until now, the isolation of the camp and the United Nations mantras on rights and gender balance have fostered a subdued but tolerant society in which women are more emancipated than their sisters back in Somalia.

This is the ultimate contradiction of camp life: how to locate hope for the future in a desperate situation that appears permanent. People are trying. Life in Dadaab and all the other camps is a daily exercise in manufacturing hope. But for many, the fiction of temporariness no longer holds. And we are seeing the results of that realization washing up on Europe’s beaches.