Pope Francis has paid his respects to Ugandan Christians who were burnt alive rather than renouncing their faith, the latest group of martyrs from around the world he has honoured.

A sombre Francis prayed at shrines dedicated to the 23 Anglican and 22 Catholic martyrs who were killed between 1885 and 1887 on the orders of a local king eager to thwart the influence of Christianity in his central Ugandan kingdom.

At Namugongo, outside the capital Kampala, where most of the martyrs were burned alive, he celebrated Mass in their honour to mark the 50th anniversary of the Catholics' canonisation.

As many as two million people are believed to have attended the Mass, including Ugandan president Yoweri Museveni, the president of South Sudan and the descendant of the king who ordered the killing of the martyrs.

Some of the pilgrims had waited all night to honour the martyrs and see the Pope, braving rains and sleeping on mats.

Beneh Ssanyu, 27, who had arrived at 1pm on Friday, said: "They are so important because they sacrificed their life because of their religion."

During his two days in Uganda, Francis is expected to touch on some of the same themes he emphasised during the first leg of his trip in Kenya: corruption, poverty and giving young Christians hope and encouragement.

Later on Saturday, Francis will join a rally with young people, visit a charity and meet with local priests, seminarians and nuns.

In preparation for his visit, workers laboured day and night fixing the narrow road leading to the shrine in Namugongo. The shrine itself underwent major repairs that were carried out like a military project: Ugandan troops from the engineering brigade joined the contractor to do everything from planting grass to laying pavement.

Francis has made a point on his foreign travels to honour local martyrs in the hope of inspiring a new generation of missionaries. When he was in South Korea, for example, he beatified 124 missionaries who helped bring the faith to the Korean Peninsula.

He has also spoken out frequently about today's martyrs, the Christians in the Middle East and Africa who have been slaughtered by Muslim militants.

The history of Uganda's martyrs has helped shape the Catholic Church in the country, with huge numbers of pilgrims flocking to the Namugongo shrine, many of them Africans arriving from as far away as Congo and Tanzania. Most of the pilgrims walk long distances to the site to underscore their faith.

On Sunday, Francis heads to his final destination of his trip, the Central African Republic.

At the shrine mass, Francis urged worshippers to use the martyrs' example of faith to be missionaries at home by taking care of "the elderly, the poor, the widowed and the abandoned".

He added: "This legacy is not served by an occasional remembrance or by being enshrined in a museum as a precious jewel.

"Rather we honour them and all the saints when we carry on their witness to Christ, in our homes and neighbourhoods, in our workplaces and civil society, whether we never leave our homes or we go to the farthest corner of the world."