MEXICO CITY — Mexico’s foreign minister drew a sharp line against “unilateral” U.S. immigration policies before talks Thursday with a top-level Trump administration team seeking to cool tensions that threaten to derail trade and other key agreements.

The visit by Secretary of State Rex Tillerson and Homeland Security Secretary John F. Kelly comes a month after a heated volley of tweets between President Trump and Mexico’s president, Enrique Peña Nieto, over who should pay for a wall on the southern U.S. border prompted Peña Nieto to cancel a White House visit.

The Twitter fight sparked concerns about a trade war between the countries after a Trump administration official implied that a 20 percent tax on goods from Mexico would be one way to force the country to pay for the wall. And this week, tensions intensified after Trump signed an executive order that would dramatically expand the pool of undocumented immigrants who would be deported to Mexico.

Against that backdrop, the two sides plan to discuss Thursday how to move forward in day-to-day relations, which include $1.5 billion in daily commerce.

Mexican Foreign Minister Luis Videgaray said Wednesday the Peña Nieto government plans to fight Trump’s immigration order, which also directs U.S. authorities to deport to Mexico all those who crossed the southern border illegally, even if they are not Mexican nationals.

“I want to say clearly and emphatically that the government of Mexico and the Mexican people do not have to accept provisions that one government unilaterally wants to impose on the other,” Videgaray told reporters in Mexico City. “We will not accept it, because there’s no reason why we should and because it is not in the interests of Mexico.”

White House press secretary Sean Spicer played down the apparently deepening rift, characterizing the relationship between the two nations as “phenomenal.”

White House officials said Thursday’s day-long discussions will cover an “ambitious agenda” that includes border trade, strengthening Mexico’s southern border with Central America, and collaborating on combating drug trafficking and terrorist threats emanating from Mexico. The discussions will also include energy security and Mexican economic policies.

Mexico is seeking to get those issues resolved before the fall, when the onset of the 2018 presidential election season could make it harder for Peña Nieto’s administration to negotiate with a U.S. president many Mexicans dislike without damaging the prospects of the candidate his Institutional Revolutionary Party fields.

Analysts say the Trump administration will also want to show residents and business investors on both sides of the border that cooler heads will prevail in relations between the two countries.

“There’s a lot at stake in the day-to-day cooperation between these two countries on security, migration and, above all, economics,” said Andrew Selee, director of the Mexico Institute at the Woodrow Wilson Center in Washington. “Tillerson and Kelly are going to want to see how they can preserve a good day-to-day relationship with Mexico even if things get rocky politically.”

In Mexico, Peña Nieto’s critics urged him to take a tougher stand against a U.S. president who they say cannot be trusted — after Trump signed an executive order to build a border wall on the eve of last month’s scheduled White House visit and then signed the immigration enforcement order ahead of Tillerson and Kelly’s visit to Mexico.

“This is worse than Lucy and Charlie Brown with the football,” said Jorge Castañeda, who served as Mexico’s foreign minister in Vicente Fox’s administration. “You’d have to be dumb to think that they’re not going to do this again and again.”

But Peña Nieto is in a delicate position as he looks to stabilize a struggling Mexican economy made more vulnerable by the uncertainty over U.S. relations.

Earlier this week, he tried to prepare Mexico for a recalibrated relationship with its powerful northern neighbor that, among other things, could mean a new deal similar to the North American Free Trade Agreement, which Trump has called “the worst trade deal in history.”

Peña Nieto’s government has been analyzing potential bargaining points on renegotiating NAFTA in the hopes of avoiding economic turmoil in a country where the peso has fallen in value.

In a meeting with Mexican media executives, Peña Nieto said NAFTA may change in name only, according to the El Universal daily. But, he cautioned, relations with the Trump administration are “a panorama of uncertainty,” the newspaper reported.