President Trump answers question about closing the border with Mexico during a meeting with Cabinet members on Thursday at the White House. (Bill O'Leary/The Washington Post)

Facing widespread opposition, President Trump backed down Thursday from his threat to close the southern border, instead giving Mexico a “one-year warning,” but also leaving his administration with no clear path to deal with a record surge of migrant families.

Trump had issued an ultimatum on Twitter late last week that he would move to seal the border to trade and travel if Mexican authorities did not halt illegal immigration.

The president’s pronouncement, coming amid reports that the U.S. Border Patrol was at the “breaking point,” surprised White House aides and sparked fear among Republican allies and business leaders over the potentially devastating economic impact of closing the 2,000-mile border with the nation’s third-largest trading partner.

In the days after his tweet, Trump and his senior advisers issued conflicting signals about his intentions, with some aides privately expressing befuddlement over his strategy. The president offered no public details, and aides worked behind the scenes to craft a plan that would satisfy Trump but minimize the economic harm.

Those efforts were rendered moot Thursday when Trump, in an exchange with reporters at the White House, suddenly shifted gears, saying that if Mexico does not stem the flow of drugs and migrants into the United States within the next year, he will impose first tariffs of 25 percent on cars and then, possibly, close the border.

“We’re going to give them a one-year warning, and if the drugs don’t stop or largely stop, we’re going to put tariffs on Mexico and products, particularly cars,” Trump said. “And if that doesn’t stop the drugs, we close the border.”

Later in the afternoon, ahead of a trade meeting with Chinese officials, Trump praised Mexico for “doing a very good job in the last three or four days since we talked about closing the border,” even though Mexican authorities have said they have not altered their enforcement policies.

The president’s decision offered relief to the U.S. Chamber of Commerce, which along with Senate Majority Leader Mitch McConnell (R-Ky.) had lobbied Trump not to act.

“We welcome the President’s decision not to close the Mexican border,” Neil Bradley, the Chamber’s executive vice president, said in a statement. He called on Congress and the White House to ensure that U.S. Customs and Border Protection, which has shifted personnel to help process the migrant families, has sufficient resources “to reduce the excessive wait times affecting legitimate trade and travel across the border.”

Homeland Security Secretary Kirstjen Nielsen this week ordered CBP to conduct “emergency surge operations” to the border, including shifting 750 agents from field operations to help the Border Patrol, a move that could produce delays at legal ports of entry.

Trump’s apparent turnaround came a day before he is scheduled to visit Calexico, Calif., a city near Mexico where a two-mile section of border fence was replaced last year. The president has sought to demonstrate progress on the wall as the number of unauthorized border crossings last month approached 100,000, the highest level in more than a decade, according to the Department of Homeland Security.

Critics have said the spike proves that Trump’s policies have failed to address the complex factors that have sparked the influx of migrant families, mostly from Central American nations, and adequately respond to the mounting humanitarian crisis. Trump this week announced that his administration would cut off some foreign aid money to Guatemala, Honduras and El Salvador, a move that analysts said could make the migration problem worse by hurting their economies.

Although Trump said his threat to close the border aimed to put economic pressure on Mexico, experts said it would do little to stem the flow of migrants, many of whom cross between legal ports of entry and seek to surrender to authorities in hopes of winning asylum protections.

Trump’s threats also exacerbated tensions with Mexico at a time when officials from that country have been trying to work with the administration to persuade Congress to ratify the U.S.-Mexico-Canada trade deal that the president announced last year.

That deal includes provisions that would spare the U.S. neighbors from new auto tariffs.

Asked Thursday about Trump’s demands, Martha Bárcena, the Mexican ambassador to Washington, said that “migration not only from Mexico, but around the world, cannot be fully stopped. What we need to have is orderly, regular and safe migration.”

She stopped short of directly criticizing Trump. “We want to continue to say to everybody that Mexico is willing to have a good relationship, that we need to work with the United States,” Bárcena said.

Mayor Armando Cabanda Alvidrez of Ciudad Juarez, Mexico — a city across the border from El Paso — said Trump’s decision “gives us a bit of certainty. There was a lot of concern in the business sector and among local people about this threat to close the border. At the very least, it’s a coherent message for the business and commercial sector. . . . It’s a real relief.”

Yet even as Trump backed off his threat, he was still facing a pressing challenge over how to respond to the escalating number of families at the border. CBP officials have said the agency is so overwhelmed that it has begun immediately releasing migrants into the country to await their immigration court hearings, a process that can take more than a year because of major backlogs.

Trump declared a “national emergency” at the border in an effort to secure $8 billion for the wall, but Democrats are continuing to explore ways to stop him.

The Bipartisan Legal Advisory Group, a panel consisting of the top House leaders, voted in a private meeting earlier Thursday to authorize litigation opposing Trump’s moves. Democrats and some Republicans argue that he is unconstitutionally circumventing Congress’s power to direct federal appropriations.

The vote of the five-member panel — consisting of Speaker Nancy Pelosi (D-Calif.), Majority Leader Steny H. Hoyer (D-Md.), Majority Whip James E. Clyburn (D-S.C.), Minority Leader Kevin McCarthy (R-Calif.) and Minority Whip Steve Scalise (R-La.) — was 3 to 2 along party lines, according to Hoyer.

Pelosi said in a statement Thursday that Trump was “stealing from appropriated funds.”

A Democratic aide said that although the vote authorized future litigation, no lawsuit was imminent. Two Texas Democrats representing border districts, Veronica Escobar and Henry Cuellar, also on Thursday introduced a resolution condemning Trump’s border shutdown threats.

In an interview on “Fox & Friends” Thursday morning, White House press secretary Sarah Sanders said Trump was making the trip to Calexico on Friday so that Americans will “get a chance to see some of the things that are going on, on the ground, and hear from the people dealing with this crisis day in and day out.”

Gabriela Martinez in Mexico City and Mike DeBonis, John Wagner and Nick Miroff in Washington contributed to this report.