As three separate migrant caravans slowly made their way north through Mexico on Saturday, newly arrived US troops worked to lay a barbed-wire fence along the Texas side of the Rio Grande.

The soldiers worked with US Customs and Border Patrol officers to lay about 1,000 feet of fencing along the river, the Defense Department said. The makeshift barrier was installed underneath the McAllen-Hidalgo International Bridge, which crosses into Mexico. The overpass is in the small town of Hidalgo, about 250 miles south of San Antonio.

“I saw that beautiful barbed wire going up,” Trump said at a Saturday campaign rally in Montana. “Beautiful sight.”

A Border Patrol spokesman said in an email to The Post that the fencing was part of “necessary preparations” for the caravans.

Roughly 900 troops have reached the US-Mexico border since the Trump administration began the deployment Oct. 26. The president vowed the forces would block the caravans, which contain thousands of migrants, from entering US turf.

Military units are heading to outposts along the border from Texas to California.

After saying about 5,000 active-duty troops would be deployed as part of Operation Faithful Patriot, Trump on Wednesday boosted the number from 10,000 to 15,000.

A separate contingent of about 2,100 National Guard troops had already been deployed to work with Border Patrol in anticipation of the caravans, which include about 7,000 people total, according to the Defense Department.

The first and largest group of migrants continued on foot Saturday after their hopes for bus rides to Mexico City were dashed. They were trudging through Sayula in the Gulf Coast state of Veracruz, about 750 miles from the US border. That contingent’s numbers have dropped to 4,000 from about 7,000 over the course of the journey, according to news reports, as nearly 3,000 applied for refuge in Mexico and hundreds of others returned home.

The governor of Vercaruz said in a Friday night video that authorities would provide buses to the country’s capital, three weeks after the group started their journey from Honduras. But Miguel Ángel Yunes almost immediately took back the offer in a second video. The pol blamed maintenance work on Mexico City’s water system, which he said left 7 million people without water over the weekend.

Mexican officials have stopped trucks and vans that offered rides to the group at various stages of their trek.

Another caravan, of about 1,000 to 1,500 people, entered Mexico last week and was about 1,000 miles from the US border as of Saturday afternoon. That group includes Hondurans, Salvadorans and some Guatemalans.

On Friday, a similar-size caravan waded across the Suchiate River from Guatemala into Mexico after Mexican authorities told the travelers they would have to show passports and visas to cross the bridge there.

Scenes of the first group of migrants fighting with police to get across the same bridge several weeks ago raised alarm in the US. Mexican officials eventually let groups cross it, but not before many migrants swam, waded or hired small boats to take them across the Suchiate.

Walking about 30 to 40 miles daily, the first group started Saturday about 760 miles away from the Rio Grande.

Post wire services