US Republican presidential candidate Donald Trump has insisted Mexico will pay for a border wall "100 percent", in a major immigration speech.
He told a cheering crowd in Arizona that he would secure the border, and left open the possibility that millions of illegal immigrants be deported.
Hours earlier, he met Mexican President Peña Nieto but said they did not discuss who would pay for the wall.
Mr Peña Nieto later insisted he had told Mr Trump Mexico would not pay.
There had been speculation that the Republican candidate would back off his plan to deport the estimated 11 million undocumented immigrants living in the US.
In his speech in Phoenix, there were conflicting signals about this.
He said their fate was not a "core issue" and that deporting "criminal aliens" would be the priority.
"We will treat everyone living or residing in our country with great dignity," he said.
But later he struck a more ominous note when he said: "Anyone who has entered the United States illegally is subject to deportation. That is what it means to have laws."
In a fiery speech that was at odds with his softer tone in Mexico City, he said he would:
- Create a "special deportation force" focused on removing immigrants arrested (not convicted) for crimes
- Cut off any path to citizenship, and insist those seeking legal status must return to their own countries first
- Introduce "extreme vetting" of immigrants to make sure they adhered to American values
- Protect the interests of African American and Hispanic workers by restricting legal immigration numbers
- Get tough on people who overstay their visas, making them subject to deportation
Mr Trump said it was the right of the US to choose immigrants that "we think are the likeliest to thrive and flourish and love us".
Elaborating on that notion, he said his "extreme vetting" would involve an ideological test for immigrants applying to live in the US.
"Applicants will be asked for their views about honour killings, about respect for women and gays and minorities, attitudes on radical Islam," he said.
Mr Trump, a New York hotel developer, stormed to an unlikely victory in the Republican primaries partly due to his tough talking on immigration.
And in Phoenix he vowed to protect the interests of Americans who he said lost out to new arrivals.
"We have to listen to the concerns that working people, our forgotten working people, have over the record pace of immigration and its impact on their jobs, wages, housing, schools, tax bills and general living conditions," he said.
He accused his Democratic rival Hillary Clinton of wanting to grant amnesty to undocumented immigrants and of advocating "open border" policies.
Reacting to Mr Trump's visit to Mexico, she said he had "choked" by not asking his hosts to pay for his wall.
Mr Trump was not the only one to depart later in the day from the cordiality of the joint press conference in Mexico City.
Amid an outcry that he had invited such an unpopular figure to Mexico, Mr Peña Nieto said some of Mr Trump's policies posed grave threats to his country.