Pope Francis has declared two of his predecessors, John Paul II and John XXIII, saints of the Roman Catholic church in an unprecedented double-canonisation mass in St Peter's Square.

The two towering figures of the 20th-century church were canonised to great applause from hundreds of thousands of pilgrims gathered in the Vatican piazza.

Pilgirms attend the canonisation mass of Popes John XXIII and John Paul II on St Peter's at the Vatican. Photograph: Alberto Pizzoli/AFP/Getty Images

"We declare and define Blessed John XXIII and John Paul II to be saints and we enrol them among the saints, decreeing that they are to be venerated as such by the whole church," said Francis in the official proclamation at about 10.15am.

People prepare to spend the night in Piazza Navona in Rome ahead of the double canonisation. Photograph: Massimo Percossi/EPA

Later, in his homily, the Argentinian pontiff paid tribute to "two men of courage" who he said had "co-operated with the Holy Spirit in renewing and updating the church". "They were priests, bishops and popes of the 20th century. They lived through the tragic events of that century, but they were not overwhelmed by them," he said.

John XXIII, he said, was a pastor to the church, "a servant leader" who had called the Second Vatican Council. John Paul II, meanwhile, was "the pope of the family".

Pilgrims gather on Saint Peter's Square ahead of a ceremony that will see popes John Paul II and John XXIII recognized as saints. Photograph: Claudio Peri/EPA

As the church approaches a crucial synod at which thorny issues to do with the family are expected to be tackled – such as the status of remarried divorcees in the church – Francis said he hoped the two new saints would intercede with God "so that … [the church] may be open to the Holy Spirit in pastoral service to the family".

Pope Francis celebrates mass during the canonisation ceremony in St Peter's Square at the Vatican of Pope John XXIII and Pope John Paul II. Photograph: Max Rossi/Reuters

Carrying flags, backpacks and rolled foam mattresses, pilgrims from all over the world had flocked into Vatican City overnight and were let into St Peter's Square from 5.30am when the piazza was opened by authorities. The Vatican said they totalled around 500,000 in St Peter's Square and the surrounding streets, while 800,000 people were thought to have gathered for the mass in Rome as a whole.