Republican presidential nominee Donald Trump speaks at a campaign rally

Republican presidential nominee Donald Trump vowed on Wednesday that anyone who is in the United States illegally would be subject to deportation if he is elected, sticking with his hardline position after flirting with a softer approach.

In a major speech in the border state of Arizona, Trump took a dim view of the 11 million people who crossed into the United States illegally, a week after saying many were "great people" who had lived in the country for years and contributed to American society.

He said all people in the United States illegally would have "only one route" to gain legal status if Trump were to win the Nov. 8 presidential election: "To return home and apply for re-entry."

"Our message to the world will be this: You cannot obtain legal status or become a citizen of the United States by illegally entering our country," Trump said.

"People will know you can't just smuggle in, hunker down and wait to be legalized," he said. "Those days are over."

Trump again vowed that Mexico would pay for construction of a "great border wall" between the two countries. He spoke hours after Mexican President Enrique Pena Nieto told Trump in a face-to-face meeting in Mexico City that Mexico would not pay for it.

"We will build a great wall along the southern border," Trump said. "And Mexico will pay for the wall - 100 percent. They don't know it yet, but they're going to pay for the wall."

Trump said at a joint news conference with Pena Nieto that he and the Mexican leader did not discuss who would pay for the wall. Pena Nieto remained silent on the issue at the event, but said later on Twitter he did raise the issue.

"At the beginning of the conversation with Donald Trump I made it clear that Mexico will not pay for the wall," Pena Nieto said in a tweet.

HARDLINE RETURN

Trump used the Phoenix speech to clarify his stance on illegal immigration after prevaricating on the issue last week. He returned to the hardline rhetoric that powered him to the Republican presidential nomination over 16 rivals, heartening those conservatives drawn to Trump by the issue.

Ann Coulter, a conservative activist who had fretted that Trump might be softening, tweeted: "I hear Churchill had a nice turn of phrase, but Trump's immigration speech is the most magnificent speech ever given."

Correct The Record, an organization supporting Democratic nominee Hillary Clinton in the Nov.8 presidential election, slammed Trump.

"Tonight confirmed what we knew all along - there is no ‘softening’,” Correct The Record spokeswoman Elizabeth Shappell said.

Trump's "America First" positions are aimed at rallying middle-class people who feel they have lost jobs to illegal immigrants or to the outsourcing of jobs abroad.

However, he may have put himself at risk of limiting his ability to broaden his base of support to include more Hispanic-Americans and more moderate Republican voters who do not think it is possible or practical to crack down on all illegal immigrants.

In his speech, Trump emphasized that his priority would be to quickly deport those among the undocumented population who have committed serious crimes.

"As with any law enforcement activity, we will set priorities," Trump said. "Anyone who has entered the United States illegally is subject to deportation. That is what it means to have a country."

He said he would form a commission to study which regions or countries he would suspend immigration from, saying Syria and Libya would be high on his list. This would be his way of carrying out his proposed ban on Muslims from some countries without getting into their religious affiliation.

Trump said he would also establish a "deportation task force" to identify criminals subject to deportation, would triple the number of federal deportation officers, and increase the number of border patrol stations.

MILD REBUKE, PROTESTS

Trump is trailing Clinton in opinion polls and the New York businessman's aides hoped the trip would make him look presidential and show he was willing to deal head-on with thorny issues such as relations with Mexico.

Pena Nieto said at the joint news conference with Trump in Mexico City that the many millions of Mexicans in the United States deserved respect. However, he offered only a mild rebuke of Trump for his rhetoric.

"The Mexican people have felt aggrieved by comments that have been made, but I was sure his interest in building a relationship is genuine," Pena Nieto said.

A few dozen demonstrators gathered beneath a monument to Mexican independence in the center of the capital to protest against the visit, some holding placards emblazoned with captions such as: "You are not Wall-come" and "Trump and Pena out."

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

Clinton, a former secretary of state, said on Wednesday Trump could not paper over his previous harsh language against Mexico.

"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 military veterans' group in Cincinnati.