U.S. border officials have reopened a port of entry along the U.S.-Mexico border after a group of migrants tried to illegally enter the country, prompting U.S. Customs and Border Patrol to respond by firing tear gas and a new call from President Donald Trump to “close the border permanently if need be.”

The port of entry at San Ysidro, north of Tijuana and south of San Diego, had been closed since about 11:30 a.m. Sunday but was reopened by 6 p.m. local time, U.S. Customs and Border Patrol said in a statement.

Thousands of Central American migrants are waiting in Tijuana and surrounding areas to apply for asylum in the U.S.

Tear gas was deployed to disperse the crowd and CBP agents apprehended multiple people who tried to enter illegally, Border Patrol said.

No one was injured, according to statements by CBP and Mexico’s Interior Ministry.

In a tweet Monday morning, Trump put pressure on the Mexican government and the country’s new president, Andres Manuel Lopez Obrador, who takes office on Dec. 1, to implement measures to send the asylum-seeking migrants back to their Central American countries.

“Mexico should move the flag waving Migrants, many of whom are stone cold criminals, back to their countries. Do it by plane, do it by bus, do it anyway you want, but they are NOT coming into the U.S.A. We will close the Border permanently if need be. Congress, fund the WALL!” Trump tweeted.

Donald J. Trump✔@realDonaldTrump Mexico should move the flag waving Migrants, many of whom are stone cold criminals, back to their countries. Do it by plane, do it by bus, do it anyway you want, but they are NOT coming into the U.S.A. We will close the Border permanently if need be. Congress, fund the WALL!

Some demonstrators on the Mexico side of the border “split off to heard towards multiple locations along the border,” and some attempted to enter the U.S. in areas “directly east and west” of the border crossing, the release stated. Some also attempted to enter the U.S. through northbound and southbound vehicle lanes at the port of entry, but they were “stopped and turned back to Mexico,” according to CBP.

The attempts to “illegally enter the U.S.” continued and CBP agents responded to them, the agency said.

United States Homeland Security Secretary Kirstjen Nielsen said in a statement that the border was closed “to ensure public safety in response to large numbers of migrants seeking to enter the U.S. illegally.”

Some migrants threw “projectiles” at CBP agents, Nielsen said. Some CBP agents were hit by rocks, the agency said.

“After being prevented from entering the Port of Entry, some of these migrants attempted to breach legacy fence infrastructure along the border and sought to harm CBP personnel by throwing projectiles at them,” Nielsen said. “As I have continually stated, 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 frontline operators, or violates our nation’s sovereignty.”

Video taken at the scene shows some migrants running near a canal close to the border, others gathering near an open fence near the border and some walking over a broken fence. One shot shows a migrant who climbed on top of a train holding a Honduran flag.

Mexico’s Interior Ministry said federal and state authorities in Baja California were able to contain a group of about 500 migrants tried to cross the border “in a violent way.”

The country’s National Institute of Migration will “immediately deport” the people who “participated in these violent events,” according to the Interior Ministry.

Mexico will not deploy military forces “in accordance with its internal policy of respect for human rights, and the non-criminalization of migration,” according to the government’s statement. But the government will reinforce the border points that people broke through as they tried to cross over to the U.S., the statement said.

More than 5,000 have been camping out inside a sports complex in Tijuana after arriving at the border city last week, the AP reported.

The number of people in the caravan currently stands at 8,247, according to the Mexican government. More than 7,400 of those migrants are currently located in the state of Baja California in the cities of Mexicali and Tijuana, the Interior Ministry said.

ABC News’ Chris Francescani, Joshua Hoyos, Amanda Maile, Elizabeth McLaughlin and Kirit Radia contributed to this report.