As part of his presidential campaign, Donald J. Trump promised an unforgiving approach to illegal immigration, including building a wall along the border with Mexico and stepping up deportations beyond even President Obama’s record removal rates. Now, among the array of immigration challenges he will face upon taking office, Mr. Trump will have to contend with this surge of migrants, an issue that has overwhelmed not only American border officials but also governments throughout the region.

Some American officials have floated the theory that families may be migrating together in the hope that adults will have a better chance of avoiding detention in the United States if they try to enter with children.

But interviews with migrants and their advocates suggest that families are fleeing — sometimes in groups of as many as 15 people — because they have no alternative. Gangs in certain communities in the Northern Triangle have become so merciless, and their control so widespread, that a family is often left with a stark choice: Comply, flee or die.

“Today the violence is widespread, and because it’s widespread, it’s affecting the whole family,” said Diego Lorente, the director of the Fray Matías de Córdova Human Rights Center in Tapachula.

Almost all of the migrants said they had once had no intention of ever leaving their countries.

Alberto said he had a thriving business breeding livestock and dogs. His wife ran a food stand. Their youngest children were on track to attend college, he said. They were active members of their church.

The family first fled in 2013 to northern El Salvador, where Alberto rebuilt his business and the children returned to school. But the gang members tracked them down, forcing them to move two more times, he said. They finally fled the country in March.