MEXICO CITY, Aug 31 (Reuters) - Donald Trump traveled to Mexico on Wednesday to meet President Enrique Peña Nieto in an unexpected trip to a country which the Republican presidential candidate has frequently vilified as the main source of illegal immigration and drug smuggling to the United States.

Trump’s visit to Mexico City took place hours before he was due to deliver a highly anticipated speech in the border state of Arizona on how he would tackle illegal immigration if he wins the Nov. 8 election.

True to Trump’s flair for the dramatic, the trip south of the border will guarantee news coverage for the New York businessman and former reality TV star. But it also took him to a country where he is widely disliked because of harsh comments he has made during his White House campaign.

Mexican opposition politicians and academics expressed disbelief that Peña Nieto would host Trump, who has accused Mexico of sending criminals and rapists across the border and cheating the United States on trade.

Trump arrived at Mexico City’s airport and headed for a meeting with Peña Nieto at the Los Pinos official residence, Mexican news media reported.

A few dozen people gathered beneath a monument to Mexican independence in the center of the capital to protest the visit, some holding placards emblazoned with captions such as “You are not Wall-come” and “Trump and Peña out.”

ASSOCIATED PRESS A woman demonstrating against Donald Trump's meeting with the Mexican president carries a sign during a morning protest at the Angel of Independence Monument that drew just a handful of people, in Mexico City, Wednesday, Aug. 31, 2016.

Republican vice presidential candidate Mike Pence said Trump would speak to the Mexican leader about border security, including his signature pledge to build a wall along the U.S.-Mexico border to counter illegal immigration.

The meeting, which Trump and his advisers began considering after an invitation from Peña Nieto last week, will be Trump’s first official interaction with a foreign leader since he began his presidential campaign more than a year ago, stirring up frequent controversy both at home and abroad.

Peña Nieto has dismissed Trump’s demand that Mexico pay for the proposed border wall and likened his tone to the ascent of dictators like Adolf Hitler and Benito Mussolini.

Trump’s campaign manager, Kellyanne Conway, asked by NBC’s “Today” show if he would speak to the Mexican president in the same blunt terms he has used at home, Conway said Trump would be “very presidential.”

A source close to the Trump campaign said he expects the candidate might apologize in Mexico for some of his rhetoric but say that illegal immigration has to stop.

Trump trails Democratic rival Hillary Clinton in most opinion polls nationally and in most battleground states with 10 weeks to go until the election.

Clinton said Trump could not paper over his previous harsh language against Mexico, which helped him defeat 16 rivals for the Republican presidential nomination.

“It certainly takes more than trying to make up for more than a year of insults and insinuations by dropping in on our neighbors for a few hours and then flying home again,” she told a convention of the American Legion veterans’ group in Cincinnati.

Carlo Allegri / Reuters Donald Trump speaks during a campaign rally in Everett, Washington, U.S., August 30, 2016.

‘DESPERATE MOVE’

Trump has been pilloried in Mexico since he launched his White House campaign last year.

He has pledged to renegotiate or scrap the 1994 North American Free Trade Agreement (NAFTA) trade deal between the United States, Mexico and Canada.

Former Mexican President Vicente Fox, who has been fiercely critical of Trump, blasted the visit, saying Trump was untrustworthy and that Peña Nieto’s invitation appeared aimed at boosting his own flagging popularity at home.

Peña Nieto has been enmeshed in his own controversies, including over whether he plagiarized some of his 1991 undergraduate law thesis.

“It is a desperate move by both sides,” Fox told CNN.

Gabriela Cuevas, a senator with Mexico’s conservative opposition National Action Party and head of the Senate foreign relations committee, said the visit was degrading for Mexico.

“Mexico looks weak as a country wanting to receive ... bullies, abusers, those who discriminate and confront. You don’t invite them to come over for coffee,” she said.

The head of a group of U.S. Republicans in Mexico, Larry Rubin, said Trump would spend about 90 minutes in Mexico City.

The last-minute trip contrasted with the usual style of foreign visits at the presidential level, which are long-planned and carefully scripted.

And foreign trips by White House hopefuls can be tricky to navigate. Mitt Romney, the 2012 Republican candidate, made a number of gaffes during a trip to London, Israel and Poland four years ago.

Clinton was also invited to meet with Peña Nieto, but it was unclear whether she has accepted.

After leaving Mexico, Trump was scheduled to make his speech on immigration at 6 p.m. MT (0100 GMT on Thursday) in Phoenix, Arizona, a state at the heart of the debate over the U.S. border.

Aides said he would reaffirm his determination to build a border wall and to quickly deport illegal immigrants who have committed crimes in the United States.

But the central question was how he would treat the majority of the 11 million illegal immigrants who have set down roots in their communities and obeyed U.S. laws. That issue has bedeviled the immigration debate in the United States for years.

Trump has shown signs of indecision on whether to go ahead with his previous proposal for a “deportation force,” saying there are some “great people” among the immigrant population and that he would like to work with them.

Conservative allies like former Alaska Governor Sarah Palin have warned Trump against rolling back on deporting illegal immigrants.

But a more moderate immigration stance could help him attract some critical swing voters in his uphill drive to win in November.

(Additional reporting by Steve Holland, and Susan Heavey in Washington and Emily Flitter in New York; Writing by Alistair Bell; Editing by Frances Kerry and Jonathan Oatis)