By Ian Dunt

David Cameron subtly contradicted some of the points made by the Pope during his UK visit with a speech which brought the papal visit to a close.

The Pope began his trip with an outspoken political speech warning Britain about the "aggressive secularism" of its society, but in his farewell speech today the prime minister ignored Britain's secular traditions to concentrate on religion.

"Faith is part of the fabric of our country," he insisted. "It always has been and it always will be.

"As you, your Holiness, have said, faith is not a problem for legislators to solve, but rather a vital part of our national conversation. And we are proud of that.

"But people do not have to share a religious faith or agree with religion on everything to see the benefit of asking the searching questions that you, your Holiness, have posed to us about our society and how we treat ourselves and each other."

The riposte will do little to ease the anger of secularists and humanists, who were offended by the Pope's opening speech outside Holyrood House.

Many reacted badly to the attempt to analyse Nazism as a uniquely atheistic political phenomenon, while others were offended by such critical comments from a visiting head of state.

But Mr Cameron's speech, which follows the beatification of Cardinal Newman in Birmingham, subtly rejects many of the Pope's assumptions about faith's monopoly on moral thinking while remaining staunchly inoffensive to the Vatican.

The insistence that people of no faith can still address moral choices directly contradicts recent papal speeches. Mr Cameron will have been keen to avoid offending atheists and humanists while maintaining the diplomacy required during a state visit.

"You have really challenged the whole country to sit up and think, and that can only be a good thing," Mr Cameron continued.

"Your Holiness, your presence here has been a great honour for our country. Now you are leaving us - and I hope with strong memories.

"When you think of our country, think of it as one that not only cherishes faith, but one that is deeply, but quietly, compassionate."