(The Washington Post)

Homeland Security Secretary John F. Kelly told Mexican officials Thursday that the United States would not use military force to deport immigrants across the border — directly contradicting what President Trump had said earlier in the day when he characterized a plan to ramp up U.S. immigration enforcement as “a military operation.”

“Let me be very clear,” Kelly said after he and Secretary of State Rex Tillerson met with Mexican Foreign Minister Luis Videgaray and Interior Minister Miguel Angel Osorio Chong. “There will be no, repeat, no mass deportations. Everything we do in DHS will be done legally and according to human rights.”

Kelly’s reassurances were part of an effort by both the Trump administration and Mexican government officials to move past the volatility that has characterized U.S.-Mexico relations since Trump stepped into the White House last month. The friction had erupted in a heated volley of tweets between the two presidents that prompted Mexican President Enrique Peña Nieto to cancel a trip to the White House.

The Twitter fight sparked concern 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 a border 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.

But while Tillerson and Kelly worked to defuse those tensions in Mexico City, Trump added more fuel to the fire in Washington by referring to a recent executive order to increase deportations as a military action.

U.S. Secretary of State Rex Tillerson, left, and Mexican foreign minister Luis Videgaray, give remarks after their meeting in Mexico City on Thursday. (Susana Gonzalez/Bloomberg)

“We’re getting gang members out, we’re getting drug lords out, we’re getting really bad dudes out of this country — and at a rate that nobody’s ever seen before,” Trump told a group of manufacturing executives during a policy discussion at the White House.

Later at a White House briefiing, press secretary Sean Spicer said that Trump was using the words “military operation” as an “adjective” to refer to the level of precision of the immigration raids.

The meeting between the senior U.S. and Mexican officials inside the Mexican Foreign Ministry struck a conciliatory tone, with both sides insisting that the day-to-day relations that include cooperative agreements on immigration, counterterrorism and trade amounting to $1.5 billion in daily commerce are too important to be derailed by political disagreements.

Tillerson said his conversations with Mexican officials were “forward-looking,” with a long view of what is at stake for the two countries. “In our meetings, we jointly acknowledged that, in a relationship filled with vibrant colors, two strong sovereign countries from time to time will have differences,” Tillerson said in a prepared statement. “We listened closely and carefully to each other as we respectfully and patiently raised our respective concerns.”

The two sides said they agreed to work together through a combination of security and economic development initiatives to stem a heavy flow of illegal immigration into the United States from violent areas of Central America.

Videgaray said both countries hope to lead a wider dialogue in the region that would add stability to Central America.

“We need to assume a regional responsibility for the development of Central America,” he said.

Videgaray raised the Mexican government’s concerns about 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.

“We have expressed to the secretaries, above all, our preoccupation over the rights of Mexicans in the United States, in particular human rights,” he said.

But former Mexican president Vicente Fox said Thursday that the gestures by Tillerson and Kelly to smooth over relations shouldn’t be taken seriously while Trump continues to talk about building a wall at the border and characterizes Mexican immigrants as criminals.

“All he does is destroy, attack and offend while his people speak suavely about creating better relations,” Fox said. “It’s a big lie.”

Analysts say the Trump administration wants 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 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.

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 for 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.

Philip Rucker in Washington contributed to this report.