For the past two weeks, Central Americans with dreams of living safely in the United States have camped out at the Little Padres baseball field, with its dirt infield and clear view of the U.S. border fence.

As the days ticked by, thousands of them have waited in lines for servings of donated beans and rice. They have showered under cold water spilling from pipes along the outfield wall and hung their underwear to dry on the chain-link backstop. They’ve slept shoulder to shoulder on slabs of cardboard and tended to the fevers and hacking coughs of their children.

But the dreams of reaching the United States have begun to fade for some here after a chaotic day at the border, where hundreds of migrants rushed the fence and U.S. authorities fired tear gas to repel them. The unrest Sunday prompted more than 500 Mexican federal police officers to take up positions around the sports complex where more than 5,600 migrants are staying.

On Monday morning, Arlin Dubon, 24, helped his partner, Karla Leticia Rodriguez, 22, and their two young children board a bus, the first leg of their voluntary deportation back to Honduras. They decided Rodriguez and the kids should leave after the unsettling confrontation at the border the day before. They had heard President Trump’s strident warnings on border closures, tasted the tear gas and wanted no more.

“The situation keeps getting worse, and the U.S. isn’t going to let us in,” he said, as the bus drove away. “I guess it’s better that she leaves.”

But while some turned back, most of the migrants plan to stay in Tijuana, still hoping to gain entry into the United States.

The mood in the tent camp Monday, with its acrid portable toilets and overflowing trash cans, was dejected and worried, while the police deployment outside underscored the fresh tension building in Tijuana. Those who want to apply for asylum in the United States don’t know if or when they might be allowed to try. The migrants looking for jobs in America say that trying again to cross might be their only option. Others have begun to look at Tijuana — one of the most violent cities in Mexico — as their new home.

Yoselin Gutierrez broke into tears at the prospect as she sat in a tent with her children, 5 and 2 years old.

“We’re fleeing death,” she said. “They killed my aunt, and I can’t even tell you the rest right now, but I’m scared.”

Gutierrez had fled her hometown of Santa Barbara, Honduras, and she was determined to wait as long as it took for her lawful chance to apply for asylum in the United States.

“These conditions are awful, but I have to wait,” she said.

As the migrants kept waiting, authorities on both sides of the border tallied the fallout from the day before.

Tijuana police said 39 migrants had been arrested for participating in Sunday’s unrest and causing disturbances. U.S. Customs and Border Protection Commissioner Kevin K. McAleenan said in a conference call with reporters Monday that an additional 69 migrants were arrested on the California side, while nearly 1,000 people ran through vehicle lanes or tried to cross at other parts of the border.

The volatile situation prompted U.S. authorities to close the San Ysidro port of entry, the busiest crossing along the U.S.-Mexico border, for six hours Sunday. Customs and Border Protection officials also fired tear gas into Mexico, prompting criticism that U.S. authorities were using violent tactics against migrants that included women and children.

Trump defended the use of tear gas as he spoke to reporters Monday before heading to a rally in Mississippi.

“They had to use because they were being rushed by some very tough people,” Trump said. “No one is coming into our country unless they come in legally.”

By law, foreigners have the right to apply for asylum if they reach U.S. soil, whether that is at a border crossing or elsewhere. This month, the Trump administration sought to require asylum seekers to cross at ports of entry, but a federal judge blocked that decision.

An aerial view shows the temporary shelter for Central American migrants in an open-air sports arena. (Guillermo Arias/AFP/Getty Images)

The Tijuana mayor has called the caravan a humanitarian crisis, and municipal officials are growing frustrated with the Mexican government’s response. César Palencia, head of the office of migrant affairs in Tijuana, said that the city needs federal money to be able to open another shelter. The issue of the migrant caravan, and the larger tensions between the United States and Mexico over immigration, will be among the most pressing issues facing Mexico’s new president, Andrés Manuel López Obrador, when he is sworn in Saturday.

The nine busloads of Mexican federal police that arrived at the sports complex Monday morning were not preventing individuals from leaving the area but also seemed intent on keeping large groups from forming.

“They came to support the Tijuana police so that there’s a stronger presence and the migrants don’t try to do what they did yesterday,” said Victor Coronel, head of migrant affairs at the Tijuana municipal police.

Tijuana’s major has called the migrant caravan a humanitarian crisis. (David Guzman/EPA-EFE/Shutterstock)

More than 8,000 migrants are waiting in Tijuana. (David Guzman/EPA-EFE/Shutterstock)

The migrant caravan began with a few hundred people who convened at a bus station in San Pedro Sula, Honduras, more than a month ago and quickly swelled into the thousands as it marched and hitchhiked north through Guatemala and Mexico. Mexican authorities say there are now more than 8,000 migrants involved.

Many of them joined because traveling with a large group is a relatively inexpensive and safe way to cross Mexico, where migrants face many dangers from the drug cartels that control the human-smuggling trade. The days of waiting in Tijuana to apply for asylum and uncomfortable conditions at the baseball stadium bubbled over Sunday, when a protest over the slow pace of the U.S. asylum process turned chaotic.

The protest had been planned by migrants since last week. The nonprofit group Pueblos Sin Fronteras, which has been among those organizing the migrant caravans this year, did not plan Sunday’s march, according to Alex Mensing, a project coordinator with the immigrant rights group.

Mensing said Pueblos Sin Fronteras has facilitated periodic “assemblies” that migrants have held along the route to plan next steps. Some migrants say it was at one of those assemblies Thursday where the idea of the protest march was discussed.

Pueblos Sin Fronteras “has been warning people about approaching the border en masse without organization, and there wasn’t organization yesterday,” Mensing said in a phone ­interview. “We’ve been warning them a violent response was possible.”

Jose Barahona, a truck driver from Honduras, ran into that response Sunday.

“They attacked us,” he said.

He said he had slipped past the first row of fencing but was forced back by tear gas. He wasn’t eager to try again.

“The U.S. isn’t going to listen to us,” he said. “I guess I’ll just go.”