South Sudan opened a new chapter in its fragile emergence from civil war on Saturday as rival leaders formed a coalition government that many observers prayed would last this time around.

A day after President Salva Kiir dissolved the previous government, opposition leader Riek Machar was sworn in as his deputy, an arrangement that twice collapsed in fighting during the conflict that killed nearly 400,000 people.

The world’s youngest nation slid into civil war in 2013, two years after winning a long-fought independence from Sudan, as supporters of Mr Kiir and Mr Machar clashed.

South Sudan Swearing In
Dr Riek Machar, during swearing in ceremony in Juba (AP)

Numerous attempts at peace failed, including a deal that saw Mr Machar return as vice president in 2016 — only to flee the country on foot months later amid fresh gunfire.

Intense international pressure followed the most recent peace deal in 2018.

Pope Francis in a dramatic gesture kissed the feet of Mr Kiir and Mr Machar last year to coax them into putting differences aside.

Saturday’s ceremony began with a presentation to them of that photo as a reminder.

Ethiopia African Union Summit
South Sudan’s President Salva Kiir (AP)

Exasperation by the United States, South Sudan’s largest aid donor, and others grew as Mr Kiir and Mr Machar in the past year pushed back two deadlines to take the crucial step of forming the coalition government.

But with less than a week before the latest deadline Saturday, each made a key concession.

Mr Kiir announced a “painful” decision on the politically sensitive issue of the number of states, and Mr Machar agreed to have Mr Kiir take responsibility for his security.

On Thursday, they announced they had agreed to form a government meant to lead to elections in three years’ time — the first vote since independence.

“Finally, peace is at our doorstep,” a reporter with the UN-backed Radio Miraya declared from Bor in long-suffering Jonglei state.

In Yambio, youth with flags were reported in the streets.

“I rejoice with the South Sudanese, especially the displaced, hungry and grieving who waited so long,” the Archbishop of Canterbury, Justin Welby, tweeted.

Hugs and applause followed Mr Machar’s swearing-in.

Even as citizens breathed a careful sigh of relief, aid groups, analysts and diplomats warned of major challenges ahead.

In a likely sign of caution, no heads of state aside from Sudan’s leader, General Abdel-Fattah Burhan, attended the swearing-in.

“While much work remains to be done, this is an important milestone in the path to peace,” the US Embassy said in a message of congratulations.

Tens of thousands of rival forces still must be knitted together into a single army, a process that the UN and others have called behind schedule and poorly provisioned.

And observers have stressed that this new government must be inclusive in a country where fighting has often occurred along ethnic lines and where several armed groups operate.

Not all have signed on to the peace deal.

Mr Kiir and Mr Machar have said outstanding issues will be negotiated under the new government.