The Mexican government tried to defuse a major trade conflict with Washington on Friday, saying that the two sides would meet in Washington next week for high-level discussions after President Trump threatened punishing sanctions related to the migrant surge at the border.

The rushed meeting comes amid a chaotic 48 hours, in which Trump defied numerous aides and ordered them to impose tariffs on Mexico because he felt the United States’ southern neighbor wasn’t doing enough to stem the flow of migrants across the border.

Trump’s tariff decision shocked lawmakers, business leaders and investors, in part because it was the second trade offensive against a major economic partner that the president had launched in the span of 21 days. Several weeks ago, Trump began charging large tariffs against $200 billion in Chinese imports. Those costs are paid by U.S. importers and then often passed along to U.S. consumers.

Mexico’s foreign minister, Marcelo Ebrard, tweeted that he would lead the Mexican delegation, while Secretary of State Mike Pompeo would represent the U.S. side.

“The summit to resolve the U.S. dispute with our country will be on Wednesday in Washington,” Ebrard said. “We will be firm and defend the dignity of Mexico.”

Ebrard spoke earlier Friday with Pompeo and Jared Kushner, Trump’s adviser and son-in-law, about the issue, according to another Ebrard tweet. “The process of negotiation is beginning,” said the Mexican official.

However, it’s unclear if White House officials share the same sense of optimism that a resolution could be swiftly reached. Trump won’t even be in Washington for the summit, as he’s scheduled to spend the week in Europe. That will leave Mexican officials to negotiate with Trump’s advisers, something that other foreign leaders have said is unproductive because the president often ignores their recommendations.

On Thursday, Trump announced he would slap a 5 percent tariff beginning June 10 against all goods entering the United States from the southern border, a surcharge that would hit millions of products like cars, machinery, fruits and vegetables. Trump promised the tariffs would escalate each month — starting July 1, reaching a maximum of 25 percent in October — unless Mexico stopped migrants from crossing into the United States.

He followed this announcement with a series of Twitter posts on Friday that attacked Mexico, Democrats and decades of foreign policy for what he alleged created a pipeline of migrants who brought drugs and crime into U.S. cities.

His Twitter posts hit on so many themes that it was unclear what precisely he was demanding in exchange for waiving the penalties. White House officials also could not articulate what Trump wanted Mexico to do, aside from simply stopping migrants from crossing the border.

“The Tariff is about stopping drugs as well as illegals!” Trump wrote.

The political and economic consequences of the tariffs could be severe. Some of Trump’s top economic advisers, Treasury Secretary Steven Mnuchin and U.S. Trade Representative Robert E. Lighthizer, raised concerns that the tariffs could imperil an overhaul of the 1994 North American Free Trade Agreement. Meanwhile, some business groups scrambled Friday to consider asking a federal judge to intervene, arguing that Trump lacked the legal authority to impose tariffs unilaterally in such a fashion.

“There’s a real risk that it could spiral into something that is not pretty,” said Carlos Pascual, who served as a U.S. ambassador to Mexico during the Obama administration.

Democrats have begun to more directly challenge Trump’s adversarial approach to trade policy, particularly his penchant for using tariffs to try to exert leverage.

Sen. Kamala D. Harris (D-Calif.), who is running for president in 2020, said the cost of these tariffs is borne by American consumers, not the countries Trump is seeking to punish.

“This is about taxing American consumers,” she said in an interview Friday with Noticias Telemundo. “People are going to have to pay more for washing machines, pay more for clothing, pay more for shampoo. When we look at the trade policy he is conducting in terms of China, now with Mexico, it’s going to result in people here paying billions of dollars more a year for consumer products.”

Mexican officials appeared initially stunned by the decision, as they had worked with the White House last year to rewrite NAFTA and thought relations had improved. Earlier on Friday, Ebrard wrote on Twitter that “the treatment of Mexico is unfair and does not make economic sense to anyone.”

Ebrard added that “Mexico is the main trading partner of the United States. What they receive from our country are essential goods and services, productivity. The flow of migrants from Central America and other countries or the high consumption of narcotics are not the responsibility of Mexico.”

Some White House officials, including trade adviser Peter Navarro, described the tariffs as a clever way to force Mexico to negotiate on stemming border crossings after complaints for months that the Mexican government wasn’t doing enough.

But the tension raised the prospect of a prolonged standoff between the United States and Mexico, and economic experts warned that it could drive up prices on thousands of products and testing the economies in both nations. It will be virtually impossible for many companies to quickly divert production of items they import from Mexico to escape the higher fees.

The United States has never issued blanket tariffs against another country in the way Trump has proposed, and his legal authority is untested. But confronting Mexico over migration has been one of the most consistent themes of his political rise, and he often pivots back to it as a way to rally his base, as he did before the 2018 midterm elections.

Despite Trump’s efforts to build a wall along the border and crack down on migration, economic ties between the United States and Mexico have only strengthened. U.S. companies imported $346.5 billion in goods from Mexico last year. The supply chains between the United States and Mexico have been forged over decades and were drawn closer by the 1994 North American Free Trade Agreement. Many major manufacturers, including Ford, Caterpillar, Whirlpool and Polaris, make products in Mexico and then ship items to the United States.

As the stock market slumped, business groups reliant on imports from Mexico struggled to come up with a response. Senate Finance Committee Chairman Charles E. Grassley (R-Iowa) decried the tariffs as a misuse of presidential power.

"This is such a negative impact for the American economy and American families and we have no choice but to explore every option to push back,” said Neil Bradley, executive vice president and chief policy officer at the U.S. Chamber of Commerce.

Trump has expressed fury that his aides have not been able to stem a surge in migration across the Mexico border. Many of the migrants are Central Americans, coming from Honduras and other impoverished countries, and Trump has blamed the Mexican government for not doing more to prevent people from entering the United States.

Even as lawmakers, business groups and foreign leaders expressed alarm, senior White House officials showed no sign of backing down or cowing under the blowback.

Acting White House chief of staff Mick Mulvaney told reporters Thursday evening that assessing Mexico’s compliance with the conditions of the new tariff would be done on an “ad hoc” basis. Navarro told CNBC on Friday that Mexico was exporting “illegal aliens” to the United States and that it had to stop.

“If you look at it from an investor’s point of view and a corporate point of view, what we have in Mexico is the export, one of their high exports, of illegal aliens. And it’s a criminal enterprise,” Navarro said.

Navarro’s appearance was notable, as he has been one of the biggest proponents of an adversarial trade policy that bucks foreign leaders. Other top economic advisers, including Mnuchin and National Economic Council Director Larry Kudlow, have privately urged a more cautious approach in the trade disputes. They had not publicly commented on the Mexico tariffs as of midday Friday.

Trump has designed the tariffs against imports from Mexico and China in a way that makes them increasingly punitive over time. White House officials believe the constant threat of more severe penalties should serve as a way to eventually force concessions.

Just a month ago, it appeared that economic relations with both countries had improved markedly, but that all changed May 5. That’s when Trump announced he would impose large tariffs on Chinese imports, and three weeks later he turned his attention to Mexico.

Over that span, the Dow Jones industrial average has fallen more than 1,200 points, or 5 percent. The Mexican peso lost 3.4 percent against the dollar on Friday as investors tried to price the fallout.

The U.S. economy relies heavily on imports from China, but it is much more interconnected with suppliers in Mexico, making the impact of tariffs hard to absorb. Matthew Slaughter, dean of the Tuck School of Business at Dartmouth College, said the tariffs against Mexico could quickly lead to the loss of “hundreds of thousands of jobs” in the United States because of how interwoven the two economies have become.

“Starting to levy tariffs on Mexico is like levying tariffs on Texas,” said Slaughter, who was a member of the White House Council of Economic Advisers during the George W. Bush administration.

Lawmakers from both parties questioned the White House’s tactics, and Sen. Rob Portman (R-Ohio) said the surprising announcement could make it much harder for the White House to win congressional support an overhaul of NAFTA later this year.

Democrats, meanwhile, accused Trump is abusing trade tactics to fulfill campaign promises that have proved elusive.

“Donald Trump has no credibility when it comes to America’s national security and no coherent plan when it comes to trade,” Sen. Ron Wyden (D-Ore.) said.

Mary Beth Sheridan reported from Mexico City.