Large groups of migrants gathered on the beach in the northern city of Tijuana at the border fence that separates Mexico from California, climbing on top of it and even jumping down to the other side as US border patrol agents looked on -- before quickly scrambling back to the Mexican side.

"We're not criminals!" some of them shouted, in a pointed message to US President Donald Trump, who has deployed some 5,900 troops to the border as the caravan approaches.

Another 4,000 migrants -- the main caravan -- are expected to reach the border in a matter of days, fleeing poverty and violence in their home countries. At least nine migrants from the caravan crossed decisively into the US side, and were promptly arrested by border patrol officers, an AFP correspondent said.

They included a mother with her four children and a 19-year-old pregnant woman from Honduras named Jazmin Monserrat.

"She didn't tell me she was going to do it. Before I knew it she was on the other side," her 17-year-old husband, Moises Hernandez, told AFP. "I understand. She's looking for a new life. We're tired of the poverty in our country."

Under an executive order Trump issued last week, migrants who do not cross at official border posts will no longer be allowed to request asylum, and face automatic deportation.

Many of the migrants in Tijuana say they will wait for the rest of the caravan to arrive before trying to cross.

- Troops 'necessary' -

Visiting the other end of the border -- Base Camp Donna, in Texas -- Mattis insisted the military deployment was "necessary" to support US Border Patrol, even as some in Trump's own Republican party criticized it as a stunt. Mattis said the military was helping border agents with a range of jobs, from ferrying them around by helicopter to putting up razor-wire fencing along the border.

There are now nearly 800 migrants from the original caravan in Tijuana, across the border from San Diego, California, after a new group of 350 arrived Wednesday morning.

Another 2,000 meanwhile traveled through the night on some 20 buses arranged by a Catholic priest, moving rapidly into northern Mexico after an arduous, month-long trek across the south and center of the country.

The buses dropped them off in the town of Navojoa, in the northern state of Sonora, then returned to pick up a second group of 2,000 migrants who had stayed behind.

Navojoa sits about 1,200 kilometers (750 miles) from Tijuana, the spot where the migrants plan to cross the border, and more than 3,000 kilometers from the town where they began their journey on October 13: San Pedro Sula, Honduras.

But the caravan is moving far more quickly through the dangerous and sparsely populated north than it did through the south and center of the country, thanks to donated transport -- sometimes from local authorities who would rather send the migrants on their way than host them in shelters. "We want to arrive as soon as possible. We've been on the road for more than a month," said Saul Rivera, 40, a construction worker from El Salvador.

- More caravans coming -

At the pace they are now traveling, the full caravan of some 5,000 migrants could be at the border by Friday.

Trump turned the caravan into a hot-button issue ahead of last week's US midterm elections, claiming -- without providing evidence -- it included "hardened criminals" and "unknown Middle Easterners" who were about to "assault" the United States.

The migrants insist they are simply seeking a better future away from Central America's "Northern Triangle" -- El Salvador, Guatemala and Honduras, poor countries where gang violence has fueled some of the highest murder rates in the world.

At least two more caravans have formed behind the first, and are currently working their way up through Mexico with about 2,000 migrants each.