It was the first time in the history of the Roman Catholic Church that two ex-popes were canonized in the same event.
Although the focus was on the late pontiffs, the elaborate ceremony and the global attention it generated seemed likely to provide another boost for the soaring reputation of Francis. The Argentine pope, who was elected last year, has become extremely popular with the faithful.
"They were priests, bishops and popes of the 20th century," Francis said in his homily of the two popes being canonized, giants of the church's turbulent, post-Word War II and Cold War eras. "They lived through the tragic events of that century, but they were not overwhelmed by them."
About 500,000 pilgrims and visitors crammed into the square and nearby streets for the solemn ceremony, including large numbers from Poland, the homeland of John Paul II. Many waved Polish flags. The canonization was followed by a Mass celebrated on the steps of St. Peter's by Francis.
Huge banners with portraits of the two former popes were displayed on the facade of the basilica. St. Peter's Square was adorned with more than 30,000 roses from Ecuador.
The crowd was so great that many were turned away from the square early Sunday, when visitors were finally allowed to filter slowly into Via della Conciliazione, the street that leads to the basilica. Those inside spent the early-morning hours braving the chill and occasional rain showers. Authorities tightly controlled the crowd's advance, seeking to avoid a dangerous crush.
"It took us three hours to get 500 yards down the street to the start of the square, but we prayed, sang and shared food — it was unbelievable," said Mark Mulvaney, 57, a real estate manager from Yorktown, Va. "An event like this that involves four popes is a once-in-a-lifetime opportunity for a Catholic."
Adding to the uniqueness of the day was the presence of Benedict XVI, Francis' 87-year-old predecessor, who stepped down last year in a rare example of a pope retiring. Francis greeted and embraced Benedict.
During the Mass, hundreds of priests and deacons fanned into the crowd to serve Communion, causing the tightly packed throngs to surge toward them.
"It was spiritual, although people were frantic," said Jackie Fernandez, a financial planner from Miami who said she was toppled in the Communion scrum.
But Fernandez said it was all worth it, not just to witness the canonization but also to see Pope Francis, a comment seconded by many other ecstatic pilgrims.
"John Paul was one of the greatest popes, but Francis is following in his footsteps and getting the young involved," said Fernandez, who came with her mother, Rosario, 75. "My daughter who is in college is following him on Twitter."
The joint canonization was championed by Francis, who, in the view of some observers, saw a singular opportunity to build bridges between the church's progressive and conservative wings. Francis sought to frame both of his predecessors in the context of the Second Vatican Council, the 1960s reform-minded event that looms large in recent church history.
John XXIII, who convened the so-called Vatican II process in 1962 but died before its conclusion, has long been admired by church liberals. John Paul II, a Pole known for his staunch anti-communism, has been an icon for many conservatives. But aspects of Vatican II were put into action by John Paul II, who served almost 27 years until his death in 2005, one of the longest tenures of any pontiff.
Francis "wanted to make this a unifying event," said John Thavis, a Vatican analyst and author. "Pairing the popes was original. And Francis astutely found a way to use Vatican II as a way to unify them."
An estimated 800,000 people descended on Rome for the dual canonization, the Vatican said. That included the half a million around the Vatican and 300,000 watching on giant TV screens set up throughout Rome.
Some attended all-night prayer vigils and confession at 11 churches throughout the Italian capital, where prayers were said in seven languages including Polish and Arabic.
Also in attendance, the Vatican said, were about 150 cardinals, 700 bishops, 24 heads of state and 93 official delegations.
Afterward, as Francis shook hands with official delegates and world leaders, some snapped selfies with the pontiff on their cellphones, including Polish President Bronislaw Komorowski.
The pope later took a spin on the popemobile through St. Peter's Square. He caught items of clothing that were lobbed at him from the crowd. At one point he smiled at someone and gestured with his hand that he would phone later.
As the throngs began to leave the square, the scene resembled the aftermath of a rock festival, with bottles, bedrolls and newspapers crunched underfoot.
But the canonization and Mass had featured all the pomp, circumstance and ritual that the church, masterful at such events, could muster.
After the ceremony began at 10 a.m., Francis was asked three times whether John XXIII and John Paul II should be saints, as protocol required. He responded by reading the Latin canonization text: "We declare and define John XXIII and John Paul II to be saints and we enroll them among the saints, decreeing that they are to be venerated as such by the whole church." Their names were officially entered in the church's book of saints.
Relics of the two new saints were placed in view. Such relics are venerated in Catholic tradition.
For St. John Paul II, the relic chosen was a vial of his blood used at his beatification in 2011 and set in an ornate reliquary. St. John XXIII's relic was a sliver of his skin taken after his body was exhumed for his 2000 beatification; the skin was enclosed under glass at the heart of a silver- and gold-plated reliquary.
Referring to John Paul II, Francis declared, "In his own service to the people of God, John Paul II was the pope of the family."
Born Karol Wojtyla in Wadowice, Poland, John Paul II became the first non-Italian pope in more than four centuries when he was elected in 1978.
He was a young man during the Nazi occupation of his homeland and was ordained when postwar Poland was part of the Soviet-dominated communist bloc. John Paul II is widely regarded as being a major force in the collapse of communism and the fall of the Soviet Union. He visited more than 100 countries during his pontificate, becoming one of the most-traveled world leaders of all time.
But some critics take issue with what they call a lack of a more forceful and immediate response by John Paul II to allegations of sexual abuse of minors by priests. The scandal has cast a pall over the church in recent years.
Although John Paul II is by far the better known of the two saints, Francis indicated he holds John XXIII in high esteem for initiating the Second Vatican Council. The process modernized the Catholic Church and led to many reforms, including changes to the Mass that allowed vernacular languages to replace Latin and priests to face worshipers.
John XXIII, born Angelo Giuseppe Roncalli, served as pontiff less than five years, from 1958 until his death in 1963. Like Francis, he was known for his lack of pretension, eschewing luxuries and seeking out the views of average Catholics.