VATICAN CITY — Retired pontiff Benedict XVI will help Pope Francis celebrate the sainthood ceremony Sunday for John Paul II and John XXIII, setting the stage for an unprecedented occurrence of two living popes canonizing two of their predecessors. About 1 million pilgrims are expected.

Vatican spokesman the Rev. Federico Lombardi said Saturday that Benedict will be in St. Peter’s Square for the canonization of John and John Paul. He said Benedict and many cardinals will “concelebrate” the Mass with Francis.

Benedict resigned from the papacy a year ago, and since has largely dedicated himself to prayer in a monastery on the Vatican grounds. Sunday’s appearance will be his highest-profile one since he retired. Francis, who lives elsewhere in Vatican City, in a guesthouse, has been quite welcoming to his predecessor, occasionally paying a call on Benedict. It was Francis who sought to include Benedict in Sunday’s ceremony.

HISTORIC OCCASION

Lombardi said that during the ceremony, cardinals and bishops will be seated on one side of the esplanade, with, presumably, Benedict, among them.

Benedict also showed up at Francis’ ceremony to elevate churchmen to cardinal’s rank in February. But that ceremony wasn’t a Mass.

As German Cardinal Joseph Ratzinger, Benedict presided over John Paul II’s funeral in the square in 2005. He was soon elected pontiff himself, going on to lead the ceremony to beatify his Polish-born predecessor in 2011, also in the square. Beatification is the last formal step before sainthood. It was John Paul who, early in his papacy, appointed the German prelate to a key Vatican post in charge of safeguarding church teaching, and eventually, also dealing with the mounting cases of sexual abuse of minors by priests in the United States and elsewhere.

Benedict has a connection to John XXII’s papacy as well. As a young theologian, he attended the Second Vatican Council, the gathering of prelates from around the globe that the Italian pope set up as a way to bring modernizing reforms to the Catholic church.

On Saturday, pilgrims were pouring into Rome, eager to be among those taking their place in the square before dawn on the day of the ceremony. The sound of hymns, in Polish, English and Italian, echoed in some of Rome’s streets.

Working to ensure the crowds are safe, authorities were deploying about 3,500 extra police in Rome, beefing up the total to around 10,000 officers. Some officers Saturday led dogs trained in sniffing out explosives along the streets near the Vatican as part of security sweeps.

Police were also trying to keep faithful from being ripped off, cracking down on vendors selling counterfeit merchandise, confiscating 1,500 boxes of rosaries resembling the ones that Pope Francis had distributed free to faithful in St. Peter’s Square in November. The boxes resemble packets of pills, in line with Francis’ description of the rosary prayer as “spiritual medicine.” The tax police also handed out fines to 23 establishments that were billing themselves as bed-and-breakfast lodgings for pilgrims, even though they lacked the proper authorization to rent out rooms.

Some pilgrims didn’t want any lodging. They rolled out mats and spread sleeping bags just on the edges of St. Peter’s Square in hopes of being among the first to enter the sprawling, cobblestoned space when it opens to the public at 5:30 a.m., four hours before the start of the ceremony.