MEXICO CITY — Mexican President Andrés Manuel López Obrador plans to meet with President Trump for the first time next month, punctuating an often tense relationship during which Trump has frequently used Mexico as his punching bag.

López Obrador said he would travel to Washington in early July to mark the start of the United States-Mexico-Canada free trade agreement. But the timing has raised questions in Mexico, where some wonder whether Trump will use it to bolster his reelection campaign.

It will be López Obrador’s first foreign trip since he took office in December 2018. Details about the meeting, including the timing, agenda and how López Obrador will travel, having put Mexico’s presidential plane up for sale, remained vague. Trump said Tuesday that López Obrador was “really a great guy. I think he’ll be coming into Washington pretty soon.”

Since López Obrador took office, the two men have said mostly positive things about one another publicly. But before his election, López Obrador published a book titled “Listen, Trump” in which he called Trump “erratic and arrogant” and compared derogatory comments Trump made in June 2015 about Mexicans to the way Nazis talked about Jews.

Trump, who campaigned on promises to build a border wall between the two countries and make Mexico pay for it, has pressured López Obrador’s government to crack down on migrants crossing Mexico en route to the U.S. border. López Obrador has generally submitted to those demands in the hope of preserving his country’s most important trade relationship. The Mexican president, an almost daily critic of neoliberalism, has championed the new North American trade deal as a critical buoy for Mexico’s economy.

López Obrador has traveled widely across Mexico on commercial airlines after pledging to sell the country’s presidential jet as an austerity measure. But he has mostly delegated foreign affairs to his cabinet, choosing not to travel beyond his country’s borders during more than 18 months in office.

Last year, Trump threatened to impose tariffs on Mexico unless it worked to stem the flow of migrants heading to the U.S. border. López Obrador sent a team to Washington to negotiate. Ultimately, Mexico agreed to deploy its national guard to detain migrants. Tens of thousands of asylum seekers are now waiting in Mexico, often in squalid conditions, for court dates in the United States. López Obrador has said little about the humanitarian impact of that U.S. policy. 

“López Obrador has made it his number one priority, foreign policy-wise, to not get into a fight with Trump, to not make him angry. And he has been flawlessly disciplined in that regard,” said Carlos Bravo Regidor, a Mexican political analyst. “It has worked to his advantage as president of Mexico in some points, but it hasn’t always been the best in terms of Mexico’s national interest.”

Mexican officials said next month’s meeting is largely about promoting the new trade agreement. 

“At a time when all countries are suffering from the economic crisis stemming from the pandemic, [Mexico] must take advantage of all diplomatic instruments to promote the” U.S.-Mexico-Canada Agreement, Roberto Velasco, director general for North America at Mexico’s Foreign Ministry, wrote in a tweet. 

“The meeting proposed by President López Obrador aims to promote our interests and is not part of internal [U.S.] political processes,” Velasco added.

But some political analysts here see the potential for a repeat of Trump’s visit to Mexico in 2016 to meet with then-President Enrique Peña Nieto. Peña Nieto invited both Trump, then the Republican nominee, and Hillary Clinton, Trump’s Democratic opponent, to Mexico City. But only Trump — who had spent much of his campaign insulting Mexican immigrants and championing a border wall — accepted.

Many Mexicans saw the visit as offering legitimacy to Trump’s rhetoric, and it was a blow to Peña Nieto’s already dwindling popularity.

Although Mexican officials say they have no intention of participating in any campaign-style event in Washington — and many of them are deeply critical of Trump privately — analysts here worry that López Obrador could quickly lose control of the event’s optics. 

“There is no way to justify meeting with Trump before November as there was no justification for the ’16 meeting,” tweeted Leon Krauze, a Mexican analyst who writes a column for The Washington Post. “Both are wrong. They play Trump’s game. A shame.”

Trump resumed meeting with foreign leaders in the White House on Wednesday after a months-long pause during the coronavirus pandemic. He received Polish President Andrzej Duda in the Oval Office, and the two made remarks to reporters. Not long afterward, Trump tweeted a video highlight reel of the visit accompanied by a dramatic score. 

But if Trump is planning to use the meeting with López Obrador, who is also known as AMLO, as a campaign set piece, it is unclear who his audience is — and whether he thinks it will resonate with Latino voters. 

“Mexican Americans in the United States have a long history and a current personal experience and a set of criteria to draw from and decide their vote,” said Bravo Regidor. “I just find it really hard to believe that they will see AMLO having a good time with Trump or whatnot and think, ‘Okay, that’s it, I am voting for the Donald,’ you know? It just doesn’t make any sense, frankly.”

López Obrador has not explained how he will get to Washington, given concerns about commercial air travel during the pandemic. Mexico and the United States have two of the highest coronavirus caseloads in the world, and there are no direct flights from Mexico City to Washington.