Congolese President Joseph Kabila will step down after elections to be held by the end of 2017 under a last-minute deal struck by political parties on Friday, the lead mediator of the talks said.

Negotiators have been in tense talks for weeks seeking to ensure Democratic Republic of Congo's first peaceful transfer of power since independence in 1960, though it remains unclear if elections can be organized by the end of 2017.

"The government is asked to take all steps so that the elections are organized by the end of 2017 at the latest," said Marcel Utembi, president of Congo's Catholic Bishops' Conference, which has mediated the talks.

Under the deal, which is expected to be formally signed on Saturday, Kabila will be unable to change the constitution to allow him to stay in power for a third term.

Kabila's mandate ran out on Dec. 19, but authorities have effectively extended it until 2018 because the government said it could not arrange elections before then.

Under the deal, the parties agreed that Kabila will appoint a prime minister from the country's main opposition bloc to oversee the transition, a major sticking point in the final stages of the talks.

Neither Kabila nor his ruling party were available for immediate comment.

Kabila's extension of his rule has sparked bloody confrontations. Security forces killed around 40 people a week ago protesting over the tenure of a leader who came to power in 2001 following his father Laurent's assassination.

Western and African powers feared the current impasse could lead to a repeat of conflicts seen between 1996 and 2003 in eastern Congo in which millions died, mostly from starvation and disease.

A successful deal, however, is seen offering a boost to pro-democracy activists in other African countries and help buck a trend in which presidents have changed constitutions to run for third terms.