Tijuana, Mexico CNN  — 

A major US-Mexico border crossing in San Diego was closed for hours on Sunday after a group of migrants on the Mexican side rushed the border area, leading US Border Patrol agents to fire tear gas at the group.

About 500 migrants on the Mexican side of the border overwhelmed police blockades near the San Ysidro Port of Entry Sunday afternoon, two journalists at the scene in Tijuana told CNN.

A migrant family runs from tear gas released by US border patrol agents near the fence between Tijuana, Mexico, and San Diego.

As the migrants tried to cross the border, authorities on the US side used tear gas to disperse them, the journalists said. Video of the scene showed a cloud of tear gas that sent people running and screaming, including families with young children.

US Customs and Border Protection said the migrants threw projectiles that struck several agents.

“Border Patrol agents deployed tear gas to dispel the group because of the risk to agents’ safety,” the agency said on Twitter.

Migrants on the Mexico side of the border take cover from tear gas fired by US agents.

The incident marked an escalation of tensions that have been mounting since groups of Central American migrants began arriving in Tijuana a few weeks ago on their journey to attempt to gain entry to the United States.

The migrants’ presence has drawn demonstrators – for and against them – and threats from President Donald Trump to close the US-Mexico border. Meanwhile, Tijuana’s mayor has called on the Mexican government and the international community for help.

The melee closed one of the world’s busiest international crossings, San Ysidro Port of Entry, to vehicle and pedestrian traffic for several hours. By Sunday afternoon, CBP reopened crossing lanes in both directions to pedestrians and vehicles.

Migrants run along the Tijuana River near the US-Mexico border after US agents threw tear gas to disperse them.

Mexico’s Interior Ministry said federal and local authorities stopped the migrants Sunday from crossing the border illegally. Those identified as having tried to illegally cross will be processed for deportation to their home countries, the ministry said.

By Sunday night, Tijuana police had arrested 39 people, the agency said on Facebook.

The Interior Ministry described Sunday’s incident as “acts of provocation” and warned that far from helping the migrants’ cause, it could result in a serious incident on the border.

How the incident began

The incident began with a march to the border that organizers said would be peaceful. In response, CBP deployed additional personnel to San Ysidro on Sunday in expectation of demonstrations on both sides of the border.

In Mexico, the march started at the Benito Juárez Sports Complex – where most of the migrants are staying – and continued to the border.

Migrants clash with law enforcement near the US-Mexico border in Tijuana.

As they reached the border area, some protesters split off toward multiple locations, CBP said. Some attempted to enter through San Ysidro and were turned away, the agency said. Others tried to enter “directly east and west of the border crossing.”

After they were prevented from entering the port of entry, some of the migrants “attempted to breach legacy fence infrastructure along the border and sought to harm CBP personnel by throwing projectiles at them,” Secretary of Homeland Security Kirstjen Nielsen said in a statement.

“DHS will not tolerate this type of lawlessness and will not hesitate to shut down ports of entry for security and public safety reasons. We will also seek to prosecute to the fullest extent of the law anyone who destroys federal property, endangers our front-line operators, or violates our nation’s sovereignty,” Nielsen said.

The mayor of Tijuana said on Sunday that he would not let the migrants’ actions damage the city’s relationship with its neighbors across the border. Residents of Tijuana work, study and visit the United States each day, and the border closures affect them, too, Juan Manuel Gastélum Buenrostro said on Twitter on Sunday.

The mayor previously said he will not commit city resources to the migrants, including money or public services. He called on the Mexican government – specifically, President Enrique Peña Nieto and his secretary of domestic affairs – to provide assistance.

“The people of Tijuana will not pay for the stay of these migrants. I will not send Tijuana into debt, just like I have been able to avoid the last two years,” he said in a November 22 Facebook post.

“We are dealing with a humanitarian crisis and the federal government must step up to its responsibility!!!”

Journalist Alfredo Alvarez and Jorge Lebrija reported from Tijuana. CNN’s Emanuella Grinberg and Mariano Castillo wrote this story in Atlanta. CNN’s Amanda Watts and Artemis Moshtaghian contributed to this report.