ROME — Pope Francis on Thursday got on his hands and knees before the leaders of South Sudan’s government and its opposition, kissing their shoes and imploring the two men to maintain the tenuous peace that exists between them.

“I’m asking you with my heart,” the pope said to the president, Salva Kiir, and the opposition leader, Riek Machar, clutching his hands in front of his chest. “Stay in peace.”

The dramatic gesture happened during a spiritual retreat by the two men at the Vatican and came only hours after the military in neighboring Sudan ousted its longtime leader, President Omar al-Bashir, after 30 years of authoritarian rule.

South Sudan gained independence from Sudan in 2011; by December 2013, the country had devolved into a civil war that killed at least 400,000 people and displaced millions.