South Sudan's President Salva Kiir signed a peace agreement with rebel factions in the Ethiopian capital on Wednesday to end a civil war that has killed at least 50,000 people, displaced two million and held up the country's progress since it gained independence seven years ago.
South Sudan plunged into warfare two years after independence from Sudan in 2011 when a political dispute between Kiir and then vice-president Riek Machar erupted into armed confrontation.
A previous peace deal signed in 2015 fell apart a year later after clashes broke out between government forces and rebels.
Machar, leader of the main rebel group the SPLM-IO, and other insurgent factions signed the new agreement with the Juba government after assurances that a power-sharing accord would be honoured.
The deal, mediated by Sudan, reinstates Machar to his former role as vice-president.
The stability of South Sudan is also important for Sudan and other neighbouring countries, who fear a new flare up of the conflict could flood them with refugees.
The civil war started in 2013, fuelled by personal and ethnic rivalries. The conflict has killed at least 50,000 people, many of them civilians, according to the United Nations.
An estimated quarter of South Sudan's population of 12 million has been displaced and its economy, which heavily relies on crude oil production, ruined.
The secession of South Sudan also hit Khartoum's economy hard, taking with it most of the region's oil reserves.
Khartoum and Juba agreed in June to repair oil infrastructure facilities destroyed by the war within three months to boost production and said a joint force would be established to protect oilfields from attacks by rebels.
The United States, Britain and Norway, known as the Troika which back peace efforts, welcomed the signing of the deal.
"We hope discussions will remain open to those who are not yet convinced of the sustainability of this agreement," they said in a statement. "We must seize this broader regional momentum to secure peace for the people of South Sudan."
Mahboub Maalim, executive secretary of the East African bloc IGAD, said the rivals had been at odds over security arrangements and governance but that the final version of the deal had addressed disagreements.
"This is probably the best-negotiated proposal signed so far," he told Reuters after it was signed at a meeting of IGAD leaders.
Asked what a failure to implement the deal would entail, Maalim said: "We expect the South Sudanese sides to embrace the wind of change in the region."
The region has seen a series of stunning rapprochements over the past months, including a reconciliation between Ethiopia and Eritrea.
IGAD had been expected to readmit Eritrea as a member on Wednesday, 11 years after Asmara walked out on the body in protest at Ethiopian forces entering Somalia.
But that move was postponed for procedural reasons and was likely to take place in the bloc's next gathering, officials said.