CIUDAD HIDALGO, Mexico — With her leg snapped and folded excruciatingly over her shoulder, Elvira López Hernández lay flat on a railroad bed as the freight train hurtled above her, clinging tightly to two things: the railroad ties beneath her and the memory of the 4-year-old daughter she had left behind in Guatemala.

“I said: ‘My God, I don’t want to die! My daughter!’ ”

She slipped off the train in January, one of scores of migrant stowaways heading to the United States. Now she sat at a shelter here, an amputee. But she had no intention of returning to the crime and desperation of Guatemala City; she was still looking north.

“What can I do?” she said.

In Washington, the biggest immigration overhaul in decades would tighten border security between Mexico and the United States to stem the flow of illegal crossings.

But there is another border making the task all the more challenging: Mexico’s porous boundary with Central America, where an increasing number of migrants heading to the United States cross freely into Mexico under the gaze of the Mexican authorities. So many Central Americans are fleeing the violence, crime and economic stagnation of their homes that American officials have encountered a tremendous spike in migrants making their way through Mexico to the United States.