US Republican presidential candidate Donald Trump is "not Christian" because of his views on immigration, Pope Francis said on his way back to Rome from Mexico.

The pope said, however, he did not want to advise US Catholics on whether or not to vote for Mr Trump.

In response, Mr Trump said the Pope will wish and pray he was president if the Vatican is attacked by the so-called Islamic State.

"If and when the Vatican is attacked by the ISIS, which as everyone knows is ISIS's ultimate trophy, I can promise you that the pope would have only wished and prayed that Donald Trump would have been president," Mr Trump said in a speech in South Carolina, using an acronym for the militant group. 

He also said Mexicans should be ashamed of using the Pope "as a pawn".

He said "for a religious leader to questions a person's faith is disgraceful".

Mr Trump added, that if elected president, he "will not allow Christianity to be consistently attacked and weakened".

In a conversation with reporters on his flight back from a visit to Mexico, Pope Francis was asked about Mr Trump and some of his statements, such as vowing to build a wall between the United States and Mexico if he becomes president.

"A person who thinks only about building walls, wherever they may be, and not building bridges, is not Christian," Francis said in answer to a specific question about Mr Trump's views. "This is not in the gospel."

Asked if US Catholics should vote for someone with Mr Trump's views, Francis said: "I am not going to get involved in that. I say only that this man is not Christian if he has said things like that.

"We must see if he said things in that way and in this I give the benefit of the doubt," he said.

On his last day in Mexico, Francis said a mass on the US border, where he spoke about immigration policies that force many underground and into the hands of drug gangs and human smugglers.

Mr Trump has also said he would deport millions of illegal migrants if he wins the November US election.

Last week he told Fox Business television that Pope Francis did not understand the Mexican border issues.

"The pope is a very political person. I think he doesn't understand the problems our country has. I don't think he understands the danger of the open border that we have with Mexico," he said.

Asked about being called a "political person", Francis said: "Thank God he said I was a politician because Aristotle defined the human person as 'animal politicus'. So at least I am a human person."

Mr Trump has taken a more than 20-point lead over US Senator Ted Cruz in the Republican race for the presidential nomination, with his campaign seeming to thrive off the endless controversies that he has generated.

Pope hints at relaxing contraception stance over Zika

Separately, Pope Francis insisted that abortion was always a crime but hinted that the Church could exceptionally relax its ban on contraception for women at risk of contracting the Zika virus.

"Abortion is not a lesser evil. It is a crime," Francis said in response to a question about how best to combat the outbreak across Latin America of the virus linked to birth defects.

But he added: "Avoiding a pregnancy is not an absolute evil."

Many Latin American countries outlaw abortion or allow it only if the mother's life is in danger.

After initially saying little about the outbreak, Catholic leaders in the region have recently begun to assert the Church's opposition to what it terms "artificial" birth control and abortion.

Instead of using condoms or the contraceptive pill, Church officials have been recommending abstinence or natural family planning.