Pope Benedict XVI gave thanks at a New Year's Eve service Sunday that he remained safe throughout his Turkish pilgrimage, which had been fraught with security worries, and he prayed for peace and justice in the world in 2007.

"That which is impossible for men, becomes possible for those who believe," Benedict said in his homily at a year's end prayer service in St. Peter's Basilica.

He prayed for "peace, comfort, justice."

For more news from the Vatican, click here.

The sweet voices of boys and the heftier tones of men blended in a hymn of praise as the Sistine Chorus performed in the packed basilica at the pope's last public ceremony of the year.

Wearing gold-colored vestments, Benedict voiced gratitude "for all the benefits that the Eternal Father has accorded us during the last year," and added: "Let one sing in the certain hope of future good."

He singled out his Nov. 28-Dec. 1 trip to Turkey as a reason for personal gratitude.

The pilgrimage was envisioned as an opportunity to reinforce Christian bonds and reach out to Turkey's tiny Christian community.

But after a Sept. 12 speech in Germany that angered many Muslims with remarks about Islam and violence, the pilgrimage became a test of the Vatican's ability to mend ties with the Muslim world, and a massive security operation was mounted to ensure the safety of the pope, his entourage and faithful who turned out for his appearances in the overwhelmingly Muslim nation.

"Thinking about that unforgettable visit, how can I not express my filial gratitude to the Holy Mother of God for the special protection that she granted to me in those days of grace?" the pope said.

Shortly after the Sept. 12 appearance, the pope expressed his regret that the speech, in which he quoted the opinion of a medieval Bzyantine emperor, had offended Muslims, and stressed that it did not reflect his own opinion.

"Thinking about that unforgettable visit, how can I not express my filial gratitude to the Holy Mother of God for the special protection that she granted to me in those days of grace?" the pope said.

Referring to secular New Year's celebration, Benedict said that such social "rites" are mainly aimed at amusement, "often carried out as an escape from reality, almost to exorcise negative aspects" and to wish for "unlikely fortunes."

The Catholic Church dedicates Jan. 1 to the theme of world peace, and the theme was expected to figure prominently in Benedict's homily during New Year's Day Mass on Monday morning in the basilica.

Greeting pilgrims in St. Peter's Square earlier Sunday, Benedict lamented that families were assailed by what he described as cultural pressures threatening to destroy the family as a social institution.

He did not elaborate, but he has devoted many of his speeches and homilies since becoming pope in 2005 to denouncing efforts in some countries to legalize same-sex marriages and give the same legal protections to unmarried couples that married couples enjoy.

For more news from the Vatican, click here.