U.S. Marines secure concertina wire along the California-Mexico border at the Otay Mesa Port of Entry in San Diego Thomson Reuters By Phil Stewart

BASE CAMP DONNA, Texas (Reuters) - U.S. Defense Secretary Jim Mattis defended the deployment of thousands of troops to the border with Mexico as he traveled there on Wednesday, saying the mission was "absolutely legal" and justified, and that it was improving military readiness.

President Donald Trump's politically charged decision to send U.S. troops to the Mexico border came ahead of U.S. midterm congressional elections last week, as Trump sought to strengthen border security as part of a crackdown on illegal immigration.

Trump's supporters, including Republicans in Congress, have embraced the deployment.

But critics have assailed the decision, calling it a political stunt to drive Republican voters to the polls. They have scoffed at Trump's comparison of caravans of Central American migrants, including women and children, to an "invasion."

Mattis, speaking to a small group of reporters traveling with him, rejected criticism and said the deployment was the right thing to do.

"It's very clear that support to border police or border patrol is necessary right now," Mattis said, noting that that was the assessment of the Department of Homeland Security.

He added the deployment was deemed legal by Trump administration attorneys and was improving readiness by giving troops more experience in rapid deployment.

The visit took Mattis near the Texas town of Donna, where U.S. troops have set up a base camp near a border crossing point with Mexico. General Terrence O'Shaughnessy, the head of U.S. Northern Command, greeted him as he landed.

Mattis said U.S. soldiers were making rapid progress erecting barriers along the border and estimated the first, construction phase of the U.S. military effort could be completed within 10 days.

"I would anticipate with what we’ve been asked to do so far, probably within a week to 10 days, we’ll have done what’s needed," Mattis told the reporters. "Of course, it will be a dynamic situation and there will be new requests coming in."

Mattis said the U.S. military was also rehearsing helicopter operations to help support U.S. border personnel, potentially flying them to new locations if the caravans of migrants shift direction.

The deployed U.S. troops are not expected to directly interact with migrants, most are unarmed, and they are only assigned tasks that support U.S. border personnel, including building temporary lodging.

SCRUTINY FROM CONGRESS

Trump's Democratic opponents have threatened to investigate the matter once they take control of the House of Representatives early next year after gaining a majority in the House in the midterm elections.

Rep. Bennie Thompson, the top Democrat on the House Committee on Homeland Security, told Reuters that Trump had used the military "as a prop to stoke fear and score political points."

"We will soon be finally able to conduct oversight of this gross abuse and the President’s many failed border security policies," said Thompson, who is expected to lead the committee when the Democrats take control of the House .

It is unclear how long the deployment will last. Mattis initially authorized it through mid-December but it could be extended.

Mattis estimated about 5,900 troops were participating in the border mission. The U.S. military has offered a breakdown accounting for 5,600 of them, estimating about 2,800 troops in Texas, 1,500 in Arizona and another 1,300 in California.

Asked whether troops' families should expect their loved ones to remain deployed through Thanksgiving or even Christmas, Mattis declined to speculate.

"We are a 365-day-a-year military. Rain or Shine. Light or dark. Cold weather or hot weather," he said, declining to estimate costs of the deployment until he had better data.

Trump railed against illegal immigration to win the 2016 presidential election and has shown no signs of easing up on the issue in the wake of last week's vote.

Last week, he effectively suspended the granting of asylum to migrants who cross the U.S.-Mexico border illegally, seeking fresh ways to block thousands of Central Americans traveling in caravans from entering the United States.

Mattis compared the mission to other deployments in the past, largely comprised of U.S. National Guard, during Democratic and Republican administrations.

"We determined that the mission was absolutely legal and this was also reviewed by Department of Justice lawyers. It’s obviously a moral and ethical mission to support our border patrolmen," Mattis said.

"There's nothing new under the sun."

(Reporting by Phil Stewart; Editing by James Dalgleish)