NOGALES, Ariz. — An American immigration agent bounded up the steps of a bus about to cross the United States-Mexico border recently and demanded to see the papers of all those aboard. “Papers!” he shouted, eyeing passengers warily as he walked up and down the aisle.

Such checks are not surprising given all the attention focused on illegal immigration these days. But this bus full of migrants was leaving the United States, not entering it.

A raft of immigration laws in Arizona and other states is designed to make life so difficult for illegal immigrants that they pack their bags and head home. But the reality on the border is that departing the country has become more complicated than ever — leading some people to worry that the outbound checks could not only dissuade illegal immigrants from leaving the country but also place them in a kind of no-win limbo, reviled if they stay and potentially arrested if they try to leave.

It used to be that entering Mexico, whether it was from San Diego or El Paso or here in Nogales, was a cakewalk, with no scrutiny on the United States side of the border and next to none on the Mexico side. But efforts by the Obama administration to reduce the flow of guns and drug money heading from the United States to Mexico have changed that in recent years.