* Two sides still have to agree where border lies
* Each side accuses other of backing rebel groups
* Mbeki gives no details of oil agreement
By Aaron Maasho
ADDIS ABABA, Aug 4 (Reuters) - Sudan and South Sudan have reached a deal on oil transit fees, but Khartoum said it would be implemented only after the issue of border security had been resolved, dampening hopes of a quick resumption of southern oil exports through the north.
The oil agreement, announced on Saturday, was a big step towards ending hostilities between the neighbours, which came close to war in April when fighting worsened along their shared border, created when the south seceded in July last year.
The two sides, deeply mistrustful of each other, have often not implemented previous agreements and still need to mark their 1,800 kilometre (1,200 mile) border and resolve charges both have made of supporting rebels in the other's territory.
The U.N. Security Council had given the African neighbours until Thursday to resolve all conflicts left over from South Sudan's secession a year ago under a 2005 peace agreement.
Landlocked South Sudan threw both economies into turmoil when it shut down its output of 350,000 barrels a day in January after failing to agree on a transit fee with Sudan, which started seizing oil to make up for what it called unpaid fees.
African Union mediator Thabo Mbeki said the neighbours had now agreed on how much South Sudan should pay to export its oil through northern pipelines. He gave no details.
"It's an (oil) agreement about all of the matters. The issues that were outstanding were charges for transportation, for processing, transit," Mbeki, the former South African president, 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.
He gave no time frame, saying only the parties had until Sept. 22 to resolve border security and other conflicts.
Sudan confirmed an oil deal had been reached but reiterated that security talks needed to resume after the Muslim fasting month of Ramadan ended at the end of August, the state news agency SUNA reported.
"Both sided reached understandings regarding oil which are considered acceptable... (but) the (oil) agreement does not fulfil the ambitions of both sides," Sudanese delegation spokesman Mutrif Siddig told SUNA. "Its implementation will start after understandings on security issues."
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.
Mbeki's announcement was a surprise as the South's top negotiator, Pagan Amum, had just said that Sudan was still demanding a high oil transit fee.
In an indication of the mistrust between the arch-foes Amum, speaking just before Mbeki, said that Khartoum was trying to "impose very exorbitant transit fees."
Both sides had made concessions in the past few days. Juba had last said it was willing to pay $9.10 and $7.26 per barrel to use two pipelines crossing Sudan, as well as a $3.2 billion package to compensate Sudan for the loss of most of its oil reserves to the South. It had previously offered $2.6 billion.
Sudan itself lowered its demand to around $22 a barrel, from an initial $36, according to a position paper published by SUNA. It also wants compensation of $3.02 billion, among other demands, Suna added.
The African Union-mediated talks, led by Mbeki, have long been hampered by differences on where to draw a demilitarised buffer zone, seen as a crucial first step to ending hostilities.
Amum reiterated calls for an arbitration body to resolve a dispute over the position of their shared border, a potentially lengthy process.
He also accused Khartoum of maintaining a police force in the disputed Abyei border region, despite U.N. requests for a complete pullout by both sides.
Mbeki said Sudanese President Omar Hassan al-Bashir and his southern counterpart Salva Kiir were due to discuss Abyei next month, after a break for Ramadan.
"We have informed them (AU) that there has been an agreement between the parties that the matter of the final status of Abyei will be addressed at the next summit meeting of the presidents (Bashir and Kiir)," he said.
Abyei was meant to have a referendum like the South under the 2005 peace agreement, but the two sides have been unable to agree on who should participate.