By Ayman Al-Warfalli

BENGHAZI, Libya (Reuters) - Libya's U.N.-backed government has signed a deal with an armed brigade controlling the major Ras Lanuf and Es Sider oil ports to end a blockade and restart exports from the terminals shut down since December 2014.

Reopening the ports would be a huge step for the North African state, which since the 2011 fall of Muammar Gaddafi has slipped into chaos that has cut its oil output to less than a quarter of pre-2011 levels of 1.6 million barrels per day.

No specific date was set for restarting exports, but swift resumption would be hampered by technical damage from militant attacks and by opposition from the state-run National Oil Corporation, which objected to paying cash to reopen the ports.

Libyan Presidential Council deputy Mousa Alkouni signed the agreement late on Thursday with Ibrahim al-Jathran, commander of the Petroleum Facilities Guards, one of Libya's many armed brigades that has controlled the terminals.

"I think the resumption depends now on technical part ... and I think also it will happen from within a week to two weeks, but not more," Alkouni told Reuters by telephone.

He said the agreement included paying an unspecified amount in salaries to Jathran's forces. He said they had not been paid wages for 26 months. Their role is protecting the oil ports, though critics have said they used it to extort money from Tripoli.

In a statement issued later on Friday, Alkouni said there was "absolutely no truth to rumors that the resumption of oil exports was the result of extortion or deals".

Rival governments and a complex network of armed groups who once fought against Gaddafi and have quasi official status are vying for power and control of the country's oil wealth, closing down pipelines and battling over export terminals.

Ali Hassi, a spokesman for Jathran's PFG brigade, said no date had been decided for reopening the ports because that would depend on the National Oil Corporation. But he confirmed an agreement had been signed between the council and Jathran.

Jathran's brigades led blockades of the ports starting in 2013, saying he was trying to prevent corruption in oil sales, though others disputed his motives. He has also called for more autonomy for his eastern region.

Opening Ras Lanuf and Es Sider would add a potential 600,000 barrels per day of capacity to Libya's crude exports, though experts estimate damage from fighting and the long stoppage must be repaired before shipments are at full capacity again.

The NOC has said damage from recent attacks by Islamic State, which expanded in the country's chaos, meant the ports would struggle to get beyond 100,000 bpd in the near term.

Beyond technical problems, NOC chairman Mustafa Sanalla has also objected to any deal with Jathran, saying it was a mistake to reward the brigade commander by paying to end his blockade of the oil ports.

Sanalla said a deal including payments would encourage other groups to disrupt oil operations in the hope of a similar payout. The NOC has also threatened to withdraw its recognition of the Presidential Council.

Eurasia Group analyst Riccardo Fabiani said the agreement was likely to stick, unlike previous attempts to reopen the ports, because both sides had an interest in making it work.

Facing resistance from hardliners and protests over living conditions, the presidential council needs oil revenues to improve services and economic stability as a way of bolstering its legitimacy. Jathran is also increasingly politically isolated and has decided to side with the council.

"Despite recent attempts by the Tripoli-based NOC to undermine the agreement, the unity government decided to prioritize the reopening of the ports," Fabiani said. "This deal will give the Tripoli authorities much-needed revenues and is a relatively easy political victory."

(Additional reporting by Ahmed Elumami in Tripoli; writing by Patrick Markey; Editing by David Evans, Toni Reinhold)