TIJUANA, Mexico—A crowd of demonstrators clashed with anti-riot police near an emergency shelter where thousands of migrants from Central America have taken refuge in recent days.

Waving Mexican flags and singing Mexico's national anthem, a bristling crowd of a hundred or more descended on a municipal sports complex the city government has converted to a shelter to accommodate the surge of migrants who arrived here as part of the famous caravan from the south. Their ultimate destination is the United States where many plan to apply for asylum.

Young men in the crowd overturned concrete barriers set in the road for crowd control and threw plastic bottles and trash at a line of helmeted police with riot shields. Some got close and hurled insults and profanities at the police, calling them anti-patriotic for protecting the migrants, whom they variously referred to as drug addicts, thieves, gang members—even rapists and murderers. It’s the same rhetoric used by President Trump about the caravan during the run-up to the 2018 midterm elections.

"You're unpatriotic to be protecting a bunch of drunks and meth-heads, stoners and drug addicts," one man shouted at officers. "Your mother should have taught you better."

For days, police have blocked all road access to the shelter and maintained a 24-hour security detail in the hardscrabble neighborhood where it is located, a short walk from the neon-lit bars and bordellos of the red light district.

“ They're not people in need. They've come here to destabilize the country. ” — Tijuana resident Cristina Gómez Sandoval

More than 3,000 migrants have arrived since Wednesday in this desert metropolis located across the border from San Diego, California. City officials say they expect the number to double in the coming days, a rate of new arrivals they say is without precedent.

Tijuana's mayor, José Manuel Gastélum, accused migrants in the caravan of being violent, crude, and “mariguanos” (“stoners”) and vowed to conduct an inquiry to decide if the city will continue to welcome them. Gastélum said the city may not have the resources to continue to shelter and support the caravan.

The tension started brewing on Wednesday night, when angry residents from a more affluent coastal area known as Playas de Tijuana confronted migrants who had gathered there to spend the night at a local park. A city official and several migrants present at the time said the confrontation began when men and women in the crowd attacked with stones; some of the migrants reacted aggressively.

In a video clip from the confrontation—seen widely in Tijuana via Facebook—a young man from Honduras threatens to "machine-gun" anti-migrant demonstrators in the crowd.

Viral videos and memes on social media have fueled much of the sentiment against the migrants.

In another viral video, a Honduran woman complained to a news crew from Germany about a lunch of refried beans and flour tortillas migrants received at the shelter. "Look at it, it's all refried beans, the sort of thing they'd feed to pigs," she said.

Several protesters referred to the video as an indication the migrants were ungrateful. There was one sign in the crowd to the effect that Mexicans proudly eat their beans. Groups of protesters in the crowd chanted that Hondurans were "pigs."

Protesters decried the migrants in the caravan as "invaders" and "ingrates." Several said the migrants overran the border checkpoint in southern Mexico.

Cristina Gómez Sandoval said she attended the protest out of concern for the threat she feels migrants in the caravan pose to public safety in Tijuana. Gómez, 40, an employee of a public relations firm, attended the protest with her 11 year-old son, Yolotl.

"They're not people in need," she said. "They've come here to destabilize the country."

Yolotl joined in, saying, “Get them out of the city so they don't cause harm."

Several motorists who drove past the protest honked their car horns in approval. One woman leaned out the window of a passing car and shouted that protesters were culeros ("assholes").

A young woman who waded into the thick of the crowd and loudly proclaimed her support for the migrants was ejected by pushing from anti-migrant demonstrators.

Later, in addressing a crush of reporters, she pointed to a tattoo on her arm that said "Pueblo unido," and said that she had acted in accordance with that sentiment.

"The people in that crowd share the political ideology of Donald Trump," she said.

Some 80 percent of the migrants who have arrived to Tijuana this week hail from Honduras, according to a city official who oversees data from the shelter's registry. Other migrants in the group are from Guatemala, Nicaragua, and El Salvador.

They have come to Tijuana after fleeing violence in their home countries and say they intend to apply for political asylum in the U.S., a process that due to more restrictive policies under Trump could take months. Others say they are driven to find higher-paying work to support their families.

Children account for approximately 21 percent of the migrants in Tijuana, according to the city official. Officials expect some 3,000 more migrants in the caravan to arrive in Tijuana from other parts of Mexico in the days to come.