FÁTIMA, Portugal — Pope Benedict XVI used a famous Portuguese shrine to the Virgin Mary on Thursday as a stage to denounce abortion and gay marriage, just days before Portugal is expected to join five European countries that have legalized same-sex weddings.

In a speech here to Catholic social service groups, Benedict called for initiatives aimed at protecting “the family based on the indissoluble marriage between a man and a woman, help to respond to some of today’s most insidious and dangerous threats to the common good.”

He also said he expressed his “deep appreciation for all those social and pastoral initiatives aimed at combating the socioeconomic and cultural mechanisms which lead to abortion, and are openly concerned to defend life and to promote the reconciliation and healing of those harmed by the tragedy of abortion.”

The audience in a chapel at the shrine gave the pope a standing ovation.

The pope’s remarks came on the third day of a four-day visit aimed at shoring up Christian belief in increasingly secular Europe, although it has been somewhat eclipsed by the sexual-abuse scandal confronting the Vatican in recent weeks. Benedict also has used the visit to signal a more forceful tone in confronting the abuse, which he has called a “sin inside the church.”