South Sudan's president signed a peace agreement with rebels on Wednesday including a ceasefire to start in 72 hours, Sudan's foreign minister said, but rebels rejected other parts of the deal.
The agreement made in the Sudanese capital Khartoum aims to end a war in which tens of thousands of people have been killed. Previous peace deals have broken down.
"The parties will continue talks in Khartoum to discuss the arrangements for implementing the ceasefire, and after it comes into place the issue of power-sharing will be discussed," Sudanese Foreign Minister Al-Dirdiri Mohamed Ahmed told Reuters.
The framework agreement comes ahead of a final settlement and would allow access for humanitarian aid, prisoners to be freed and a transitional unity government to be formed after four months, Ahmed said.
It comes after two days of talks between President Salva Kiir and rebel leader Riek Machar, a former vice president. The country's civil war began in 2013, less than two years after it gained independence from Sudan.
The war has uprooted a quarter of South Sudan's population of 12 million, ruined the country's agriculture and battered its economy.
"This agreement signed today and the ceasefire will end the war in South Sudan and opens a (new) page," Machar told reporters after the signing ceremony, hailing what he said would be a building of trust with South Sudan's northern neighbor.
The agreement signed with other opposition leaders provides for the new unity government to rule for three years, followed by a general election, Ahmed said.
Kiir said he would "commit respectfully" to the deal.
One of the proposed points of the agreement was to have three different capitals for South Sudan to distribute power but a spokesman for Machar rejected this.
"We will sign the framework today, with some amendments. Most notably, we reject the three capitals - South Sudan is one country - and we reject foreign forces coming into our land," the spokesman, Mabior Garang Mabior, said, apparently referring to proposed monitoring of the ceasefire by regional African group Intergovernmental Authority on Development (IGAD) and African Union forces.
"We also reject the resumption of oil production prior to a comprehensive negotiated settlement," Mabior said.
Sudanese President Omar al-Bashir, who hosted this week's talks, said the agreement was a "gift to the people of South Sudan."