WASHINGTON -- U.S. President Donald Trump, who has denigrated Mexican migrants and threatened the U.S. ally with crippling tariffs, welcomed President Andres Manuel Lopez Obrador to the White House on Wednesday, called him a cherished partner and claimed the countries' economic and security ties were reaching new heights.

Trump's warm words were in stark contrast to the days when he called Mexicans "rapists" and railed against migrants entering the United States illegally. Lopez Obrador had cordial words for Trump, too, saying that while they have disagreed, it was better to find common ground and avoid slinging insults.

The meeting was billed as a celebration of economic ties and the new U.S.-Mexico-Canada trade agreement, but critics in Mexico worried Lopez Obrador was being used as a political pawn to bolster the Trump campaign and his "America first," anti-illegal migration agenda. Despite the verbal backslapping in the Rose Garden, thorny issues -- from immigration to investment -- remain.

Trump has dialed back his harsh words since Lopez Obrador took office a year and a half ago. And Lopez Obrador signalled he wanted to put the insults in the past.

"As in the best times of our political relations, during my term as president of Mexico, instead of insults toward me and more importantly against my country, we have received from you understanding and respect," Lopez Obrador said.

Their relationship is an odd bromance: Lopez Obrador is a veteran leftist and Trump tacks right.

"Some thought that our ideological differences would have led us inevitably to confrontation," Lopez Obrador said. "Fortunately, this bad omen didn't materialize and I consider that in the future there will be no need to break our good political relations, nor the friendship between our governments."

Later, Lopez Obrador said: "The forecasts failed. We didn't fight. We are friends, and we're going to keep being friends."

Trump their friendship developed "against all odds."

Trump's national security adviser Robert O'Brien said the two leaders have "really hit it off" and exchanged gift baseball bats during their meeting. Trump signed and gave Lopez Obrador a custom Louisville Slugger, and the Mexican president gave the president a bat manufactured by indigenous people in southern Mexico, O'Brien said on Fox Business Network's "Lou Dobbs Tonight."

The two signed a declaration highlighting U.S.-Mexico relations and the USMCA. Canadian Prime Minister Justin Trudeau decided not to come to Washington to celebrate the agreement, citing scheduling conflicts.

Trump and Lopez Obrador also pledged to co-operate in responding to the coronavirus, which has rocked both nations. Since March 2020, movement across the border has been restricted to essential travel while allowing the flow of goods and services. Last year, Mexico became the largest goods trading partner of the United States.

Lopez Obrador arrived at the White House after morning stops at the Lincoln Memorial and a statue of Benito Juarez, a former Mexican president and national hero. Trump and a military honour guard greeted him at the White House. The two posed for pictures and Trump flashed a thumb's up. They also were to have dinner at the White House with about 20 U.S. and Mexican business leaders, including Carlos Slim, one of the richest men in the world.

With the U.S. looking to reduce its dependence on China for parts and supplies, Mexico is well-positioned to step into the void, though U.S. businesses have viewed some recent actions taken by the Mexican government as harmful to U.S. investors and say they undermine the framework of the USMCA. Lopez Obrador didn't publicly address U.S. business' concerns.

"If there is not a better investment climate for both foreign and domestic private investment, it will be very difficult to use the opportunity of USMCA and the drift between China and the United States to our advantage," Geronimo Gutierrez, who was Mexico's ambassador to the U.S. in 2017 and 2018, said during a virtual event hosted by the Wilson Center.

With no meetings planned with former Vice-President Joe Biden, Lopez Obrador seemingly is banking that Trump will win a second term. The Democratic Party chairman, Tom Perez, recalled Trump's insults of Mexicans and said the president was now trying to take credit for a trade deal that Democrats in Congress helped make possible.

"Latino communities, immigrants, and the American people deserve a president with the empathy and experience to lead us forward, not a demagogue who cheers on bigotry from the White House," Perez said, urging voters to elect Biden.

When he arrived at the White House, Lopez Obrador and Trump did not shake hands as would have been customary before the pandemic. White House spokesman Judd Deere said all members of the Mexican travelling delegation were tested for the virus. The presidents sat at tables positioned many feet apart to sign their joint statement.

Lopez Obrador likes to point out that Trump helped Mexico reach a deal with other oil-producing nations to cut production and aided Mexico in obtaining more ventilators to cope with the coronavirus pandemic. Both presidents talk about a blossoming friendship that seems to stem from their pursuit of nationalist agendas.

Many Mexicans, however, remain wary of Trump, whose denunciations are intended to rally his most loyal supporters. Trump has threatened tariffs to strong-arm Mexico into playing an uncomfortable role in U.S. immigration policy and insisted that Mexico will pay for a border wall meant to keep migrants out of the U.S.

White House press secretary Kayleigh McEnany wouldn't get into detail about what the two presidents said about immigration. Mexico deployed 27,000 troops to the border to help stem the tide of illegal immigrants from Central American.

------

Associated Press writer Christopher Sherman in Mexico City and Aamer Madhani in Washington contributed to this report.