TONALA, Mexico — Central American migrants traveling through southern Mexico toward the U.S. on Tuesday fearfully recalled their frantic escape from police the previous day, scuttling under barbed wire fences into pastures and then spending the night in the woods after hundreds were detained in a raid.

In the Chiapas state town of Tonala, migrants flocked to one of the few places they felt they could be safe — the local Roman Catholic church — only to start with fear at the sound of a passing ambulance's siren.

"There are people still lost up in the woods. The woods are very dangerous," said Arturo Hernández, a sinewy 59-year-old farmer from Comayagua, Honduras, who fled through the woods with his grandson. "They waited until we were resting and fell upon us, grabbing children and women."

Mexican immigration authorities said 371 people were detained Monday in what was the largest single raid so far on a migrant caravan since the groups started moving through the country last year.

The once large caravan of about 3,000 people was essentially broken up by the raid, as migrants fled into the hills, took refuge at shelters and churches or hopped passing freight trains. A brave few groups straggled along the highways, but with dozens of police and immigration checkpoints, they were bound to be caught.

A migrant family is detained by police during a raid in Pijijiapan, Mexico, on April 22, 2019. Jose Cabezas / Reuters

Journalists from The Associated Press saw police target isolated groups at the tail end of the caravan near Pijijiapan Monday, wrestling migrants into police vehicles for transport and presumably deportation as children wailed.

Now terrified of walking exposed on the highways, some turned in desperation to a tactic that used to be a popular way north, clambering aboard a passing freight train bound for the neighboring state of Tabasco. It's been years since migrants hopped trains in large numbers.

Javier Núñez, a 25-year-old Honduran, said he and his family walked through the hills, along a river and by some train tracks after Monday's raid before venturing into the town of Pijijiapan to find something to eat. But agents appeared again Monday night and detained his wife and son, who he said were taken to an immigration facility in Tapachula for deportation processing.

"They were hunting us," Núñez said. As he sees it, the only thing to do is go on alone, see how far he can make it. "Now we are afraid of everyone who looks at us or approaches."

Asked about the detentions at a Tuesday morning news conference, Mexican President Andrés Manuel López Obrador acknowledged that the government is not letting migrants simply go wherever they please. He denied taking a hard line, saying controls are for migrants' security because human traffickers are allegedly infiltrated among the caravans.

"We don't want for them to just have free passage, not just out of legal concerns but for questions of safety," López Obrador said.

His immigration chief, Tonatiuh Guillén, said later that Monday's incident was "regrettable," particularly in the case of the children who were frightened.

He said it was not something he wanted to repeat. But he also maintained it was a normal migration enforcement action.

Guillén said Mexico has deported 11,800 migrants so far this month and is being more selective in who is given a humanitarian visa, which allows a migrant to remain in the country and work.

Interior Secretary Olga Sánchez Cordero said the migrants who were detained Monday had refused to register for a regional visa that would have allowed them to remain in southern Mexico.

While U.S. President Donald Trump has ramped up public pressure on Mexico to do more to stem the flow of Central American migration through its territory, López Obrador has rejected criticism from some that the immigration policy seems unclear or even contradictory.

In recent months Mexico has deported thousands of migrants. It has also issued more than 15,000 humanitarian visas.

AP journalists who were present for the raid did not witness any initial violent behavior by the migrants, though immigration authorities said otherwise. During a second detention operation, some from the caravan took up rocks and clubs and at least one stone was thrown, but authorities did not report any injuries to agents.

It was "a planned ambush ... to break up this caravan," said Denis Aguilar, a factory union leader from San Pedro Sula, Honduras. "They grabbed the children ... the strollers are abandoned there."

Aguilar said he and his brother fled through the woods until they found a ranch house whose residents took them in. In the morning, the family drove them to a bus stop.

Maria Mesa, a homemaker from La Esperanza, Honduras, said she saw officials tugging children as their mothers battled to pull them through the barbed wire fences. She saw other children weeping, alone, on the edge of the woods. Mesa has kids of her own, but left them home because she knew it would be a hard journey.

Her decision to go alone contrasts with the many thousands of others from Central America migrating with relatives toward the U.S. border, where detentions of people traveling in families have spiked. They typically say they are fleeing violence and poverty in their home countries, and many hope to seek asylum.

Those who arrive at the U.S. border must contend with policies limiting how many are allowed to apply for refuge each day. The United States has also returned some to wait in Mexico while their asylum cases inch through a backlogged court system. Trump recently told migrants not to come, saying: "Our country is full, turn around."

Migrants who opt to join caravans do so figuring there is safety in numbers and also because it is a relatively inexpensive alternative to paying thousands of dollars to a "coyote," or smuggler.

But they are finding it a much tougher go through Mexico than before. In addition to Monday's dramatic raid, migrants have experienced a cooler reaction from townspeople, who last year donated food and clothing but have grown tired of the groups. Migrants say once-friendly Mexicans now refuse to give even water, leaving them no choice but to drink from puddles at times.

"People don't want them to enter the towns," said Gerardo Lara Espinosa, a bus dispatcher in Tonala, who said the caravans are seen as overwhelming small towns and hurting businesses.

Mexican officials said last month they would try to contain migrants in the Isthmus of Tehuantepec, Mexico's narrowest stretch and the easiest to control. Pijijiapan is not far from the isthmus' narrowest point, in neighboring Oaxaca state.

About 300 migrants hopped a train Monday to Ixtepec, in Oaxaca. On Tuesday, others were walking along the road to Tonala, about 50 miles (80 kilometers) from Pijijiapan.

Jorge Herrera, a farm worker from El Progreso, Honduras, said he and his 7-year-old son fled through the woods after the raid. The boy is sunburned and has cuts and mosquito bites. Herrera thinks López Obrador is doing Trump's dirty work.

"He must be bought. He must be paid for them to do this to us," Herrera said.

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.