WASHINGTON - U.S. Republican presidential contender Donald Trump and Mexican President Enrique Pena Nieto have held talks in Mexico City, with the host leader saying Trump's visit demonstrates that the United States and Mexico are important to each other.

At a news conference following their meeting, Pena Nieto said the bilateral relationship should be based on mutual respect.

Trump has ridiculed Mexico, saying it sends rapists and criminal immigrants into the United States and takes advantage of American workers in a two-decade-old trade deal. He won millions of Republican supporters with his call to build a wall along the U.S.-Mexican border to thwart more illegal migration and to force Mexico to pay for it, an idea Pena Nieto has rejected outright.

Demonstrators hold placards during a protest again Demonstrators hold placards during a protest against the visit of U.S. Republican presidential candidate Donald Trump at the Angel of Independence monument in Mexico City, Mexico, Aug. 31, 2016. Demonstrators hold placards during a protest against the visit of U.S. Republican presidential candidate Donald Trump at the Angel of Independence monument in Mexico City, Mexico, Aug. 31, 2016.

Pena Nieto said he and Trump had "open and constructive talks." He said he took the opportunity to tell Trump that Mexicans in the U.S. contribute in many ways, and that they are honest and hard-working.

For his part, Trump told the news conference that he has "tremendous feelings for Mexican-Americans in the United States." He called them "spectacular, hard-working people."

But he called for ending illegal immigration from Mexico, and elsewhere, into the U.S. He said either side has the right to build a physical wall along the border to keep out illegals.

Trump announced his hastily planned visit to Mexico City just days after the Mexican leader extended an invitation for both Trump and his Democratic opponent, former U.S. Secretary of State Hillary Clinton, to visit.

WATCH: Trump's statements about Mexico



Pena Nieto, after listening for months to Trump's taunts about his country, likened him to Hitler and Mussolini, and awoke to a storm of protest about his meeting with Trump, who is widely reviled in Mexico. Former President Vicente Fox told CNN that he does not understand why Pena Nieto extended the invitation, saying, "He [Trump] is not welcome to Mexico. He is going to be rejected by everybody here."

Arizona immigration speech

Trump's visit to Mexico adds new importance to his previously planned immigration speech in the southwestern border state of Arizona, with the trip giving him a chance to showcase his candidacy on an international stage at a time when virtually all U.S. national political surveys less than three months ahead of the quadrennial election show him losing to Clinton.

A demonstrator protests against the visit of U.S. A demonstrator protests against the visit of U.S. Republican presidential candidate Donald Trump at the Angel of Independence monument in Mexico City, Mexico, Aug. 31, 2016. A demonstrator protests against the visit of U.S. Republican presidential candidate Donald Trump at the Angel of Independence monument in Mexico City, Mexico, Aug. 31, 2016.

Trump has wavered in recent days on his immigration plans, still vowing to build the border wall but offering mixed signals whether he would adhere to his earlier proposal to create a "deportation force" to send 11 million undocumented immigrants living in the U.S. back to their home countries.

He says he plans to quickly deport immigrants convicted of U.S. crimes and those who have overstayed their visas. Trump, seeking elected office for the first time, says he has no plans to give law-abiding immigrants a path to U.S. citizenship and that they should pay back taxes they owe, but otherwise has not spelled out what their immigration status should be.

Pena Nieto's office said he invited both Trump and Clinton for talks because he believes in dialogue to promote Mexico's interests and "mainly to protect Mexicans wherever they are."

WATCH: Hillary Clinton on Trump's rhetoric, international relationship building



Clinton has not yet accepted offer

There was no word from the Clinton campaign as to whether she planned to accept the offer. However, her communications chief Jennifer Palmieri released a statement criticizing Trump's numerous statements attacking Mexico.

"What ultimately matters is what Donald Trump says to voters in Arizona, not Mexico, and whether he remains committed to the splitting up of families and deportation of millions," Palmieri said.

Clinton addressed the annual convention of a veterans' group, the American Legion, on Wednesday, stressing her support for the idea of American exceptionalism as the world's biggest military power and "a global force for freedom."

"People all over the world look to us to lead," she said. "We are an indispensable nation."

She portrayed Trump as unfit to become the country's commander in chief, saying "the last thing we need is a leader who brings more name-calling and tantrums to Washington."

She disparaged his trip to Mexico, saying that leadership "certainly takes more than trying to make up for a year of insults and insinuations by dropping in on our neighbors for a few hours, and then flying home again. That is not how it works.”

FILE - Republican presidential candidate Donald Tr FILE - Republican presidential candidate Donald Trump supporter Luisa Aranda gestures as she is interviewed before Trump spoke at the California Republican Party 2016 Convention in Burlingame, Calif. FILE - Republican presidential candidate Donald Trump supporter Luisa Aranda gestures as she is interviewed before Trump spoke at the California Republican Party 2016 Convention in Burlingame, Calif.

Why Arizona?



Arizona, where Trump is speaking after returning from Mexico, has for years been a focal point of U.S. efforts to curb the stream of illegal immigrants into the country. About half of the 11 million undocumented immigrants living in the U.S. are Mexicans, with many of the remainder from Central American countries to the south of Mexico.

"From day one I said that I was going to build a great wall on the SOUTHERN BORDER, and much more. Stop illegal immigration," Trump wrote on his Twitter account Tuesday ahead of the announcement of the Mexico City trip.

Trump's staunch, nationalist anti-immigration stance won him wide support in the state-by-state Republican presidential primaries, helping him surge past seasoned politicians to the Republican nomination. But U.S. surveys show many voters in the broader electorate are opposed to mass deportation of families, many of whom have been living in the country for years.

CEO at work



His vice presidential running mate, Indiana Governor Mike Pence, told an interviewer Sunday that Trump is like "a CEO at work," a corporate chieftain consulting with people and considering his options.

"You see someone who is engaging the American people, listening to the American people," Pence said. "He is hearing from all sides."

Clinton favors border protection, but also comprehensive immigration reform, with a pathway to citizenship for undocumented immigrants already in the country. But such legislation has been stalled in Congress, with Republican opponents in the House of Representatives blocking a plan passed by the Senate and supported by President Barack Obama.

Clinton, seeking to become the first female U.S. president, holds a 5.3-percentage-point lead over Trump in the latest compilation of national polling by the realclearpolitics.com political website.

Numerous U.S. political analysts are predicting she will become the country's 45th president when President Barack Obama leaves office in January, but also say that unforeseen world events or blunders by either candidate in three scheduled Trump-Clinton debates in September and October could alter the track of the campaign.