Pope Francis has begged forgiveness for members of the Catholic Church’s hierarchy who “kept quiet” about clerical child sex abuse.
He was ending a two-day visit to the Republic of Ireland by celebrating a Mass at Dublin’s Phoenix Park.
The Argentine Pope asked forgiveness for the “abuses in Ireland, abuses of power, conscience and sexual abuses” perpetrated by Church leaders.
It was the first papal visit to Ireland for 39 years.
The Pope waved goodbye to dignitaries, including Irish Prime Minister (Taoiseach) Leo Varadkar, before his plane left for Rome.
Earlier, he said no-one could fail to be moved by stories of those who “suffered abuse, were robbed of their innocence and left scarred by painful memories”, and reiterated his wish to see justice served.
The Vatican estimated that 300,000 people flocked to Phoenix Park for the Mass to close the World Meeting of Families, a global Catholic gathering that is held every three years. Other crowd estimates were lower.
Pope Francis used the penitential rite of the Mass to list a litany of different types of abuse and mistreatment inflicted on Irish people by Church figures, and the cover-ups of sex crimes.
On each occasion he asked for forgiveness, the congregation applauded.
From love letter to a plea for forgiveness – By Leanna Byrne in Dublin
In 1979, the Pope told Ireland he loves her. In 2018, he asks her for forgiveness.
The theme of forgiveness has touched every one of his events: the quiet arrival, the sombre speeches and the modesty of it all.
This theme reached its pinnacle at the mass at the Phoenix Park.
Well received, Pope Francis has filled the once in a generation papal visit, his words of remorse welcome.
Earlier, he visited Knock during the second day of his trip.
The Marian shrine is a place of Catholic pilgrimage in the west of Ireland, where an apparition of Mary, the mother of Jesus Christ, is said to have appeared in August 1879.
Each year, about 1.5 million pilgrims from across the world visit the shrine, which also hosted Pope John Paul II during his visit to Ireland in 1979.
The Irish Catholic Church has been rocked by revelations of paedophile priests, sexual abuse in Catholic-run orphanages, and the exploitation of women in mother-and-baby homes.
During the first day of his trip, Pope Francis used a speech at Dublin Castle to express his shame at the Catholic Church’s failure to adequately address the “repellent crimes” of sex abuse by clergy.
He later met eight survivors of sexual abuse, reportedly telling them he viewed clerical sex abuse as “filth”.
Mr Varadkar delivered a strong warning to the Pope to take action against clergy involved in child abuse and in keeping it secret.
Pope Francis told the crowds at Knock that the “open wound of abuses” committed by the Roman Catholic Church challenged it to be firm in the pursuit of truth and justice.
He said in his prayer to Mary, the mother of Jesus, he had “presented to her in particular all the victims of abuse of whatever kind committed by members of the Church in Ireland”.
Later, in Phoenix Park, he also asked “forgiveness for those single mothers who went looking for their children who had been taken away. It is not a mortal sin.”
Meanwhile in Tuam, County Galway, about 1,000 people gathered for a silent vigil to remember the Tuam Babies.
The Tuam home was one of 10 institutions in which about 35,000 unmarried pregnant women are thought to have been sent.
Large crowds also attended a Stand4Truth event in Dublin to show solidarity with victims of clerical sex abuse.
Meanwhile, a former top Vatican official called on the Pope to resign, saying the pontiff knew about allegations of sex abuse by a prominent US cardinal for five years before accepting his resignation last month.
In an 11-page letter, Archbishop Carlo Maria Vigano said he had told Pope Francis in 2013 that Cardinal Theodore McCarrick had faced extensive accusations of sexually abusing lower-ranking seminarians and priests.
The Vatican has not responded to these claims – and Archbishop Vigano has not produced any written or other evidence to verify his conversation with Pope Francis.
Correspondents say the timing of his letter, released to coincide with the Pope’s landmark visit to Ireland, has raised questions about whether this is a co-ordinated attack from traditionalists within the Catholic hierarchy who oppose Pope Francis.
On Saturday evening, Pope Francis presided over a Festival of Families concert in Dublin’s Croke Park stadium, which drew a crowd of about 80,000 people.
The world-renowned tenor Andrea Bocelli, country singer Nathan Carter and acclaimed Irish singer Daniel O’Donnell were among those who performed.
The Ireland that the Pope is visiting is a different country to that which greeted Pope John Paul II in 1979.
Since the Polish pope’s visit, there have been huge changes in public attitudes to social issues including abortion, contraception, divorce and same-sex marriage.
The country voted for constitutional change on same sex-marriage in 2015 and voted overwhelmingly to overturn its strict abortion law in May.
Pope Francis heard Mr Varadkar, a gay man, speak out against the traditional Catholic teaching on the family.
The taoiseach said that the Republic of Ireland had modernised its laws, “understanding that marriages do not always work, that women should make their own decisions and that families come in many forms” – including those headed by a lone parent, same-sex parents or parents who are divorced and remarried.
You can follow minute-by-minute updates on the Pope’s visit here on the BBC News website.
Switch on for Sunday’s BBC Newsline showing highlights from the visit at 22:30 BST.