Sudan and South Sudan have reached a badly needed oil deal and will discuss restarting oil production soon but still need to resolve key border security issues to end hostilities, a mediator from the African Union said on Saturday.

There was no immediate confirmation from the African arch-foes, which came close to war in April when border fighting escalated to the worst violence since South Sudan split off a year ago under a 2005 agreement to end decades of civil war.

If confirmed, an oil deal would mark a big step forward in ending a long list of conflicts left over from the duo’s messy divorce as oil is the lifeline for both.

“It’s an (oil) agreement about all of the matters. The issues that were outstanding were charges for transportation, for processing, transit,” former South African President and AU mediator Thabo Mbeki told reporters.

“What will remain (now)…is to then discuss the steps as to when the oil companies should be asked to prepare for the resumption of production and export,” Mbeki said in Addis Ababa where the talks take place.

He gave no details or time frame.

The neighbours, which share a deep mistrust and have often not implemented previous arrangements, will still have to resolve the thorny issue of marking their disputed border.

Landlocked South Sudan threw both economies into turmoil when it shut down in January its output of 350,000 barrels a day after failing to agree on a transit fee with Sudan, which started seizing oil to compensate for what it called unpaid fees.

Oil industry sources have said restarting oil production could take six months or longer as the pipelines have been filled with water to avoid gelling and some wells were not closed properly in a rush.

Mbeki’s comments came as a surprise after the South’s top negotiator Pagan Amum had just earlier accused Sudan of demanding a high oil fee. Both delegations had also hours earlier broken off talks without a comprehensive deal after a U.N. Security Council deadline expired.

Mbeki said both sides had now time to settle the key security issue and other conflicts by 22 September.

But it was not clear how an oil deal would be implemented as Sudan has repeatedly said it would not agree on southern oil exports before settling the border issue.

“Any agreement on oil shall be subject to the implementation of a full and final agreement on security matters,” Sudan’s delegation said in a position paper published on Friday.

In an indication of the mistrust between the arch-foes, Juba’s top negotiator Amum said, speaking just before Mbeki, that Khartoum was trying to “impose very exorbitant transit fees.”

Both sides had improved their offers in the past few days. Juba said last it was willing to pay $9.10 and $7.26 per barrel to use two pipelines crossing Sudan, alongside a $3.2 billion package to compensate for the loss of most oil reserves to the South. It had previously offered $2.6 billion.

Sudan itself lowered its demand to $15 a barrel per pipeline, down from $32, according to officials. It had until last week insisted on $36 a barrel.