TRIPOLI (Reuters) - Libya's state energy company National Oil Corporation has agreed to merge with a rival company established in the east by one of the country's two former competing governments, the NOC said in a statement.

The merging of the two NOCs is a positive step to recovering the OPEC member's oil sector which has been battered by militant attacks, rival export attempts and closures of pipelines and oil ports by armed factions.

It is also a boost for the U.N.-backed unity government and its presidential council in Tripoli that has struggled to extend its influence over hardline factions and their armed supporters who set up rival administrations in the capital and in the east.

The NOC said current chairman, Mustafa Sanalla, who was named executive before any rival administrations were in place, will remain in the top post while former eastern NOC head Nagi el-Maghrabi will join the unified NOC board.

"There is only one NOC, and it serves all Libyans," Sanalla said in the statement. "This agreement will send a very strong signal to the Libyan people and to the international community that the Presidency Council is able to deliver consensus and reconciliation."

Prime Minister Fayaz Seraj's presidential council has been in Tripoli for three months since a U.N.-brokered agreement, but it has struggled to make progress and still faces resistance from hardliners who reject its authority.

With no national army, Libya's brigades of former rebels who once battled to oust Muammar Gaddafi in 2011 have turned against each other backing rival political leaders in a scramble for control of Libya and its oil resources.

Libya's oil exports are less than half of the 1.6 million barrels per day it produced before the 2011 uprising. Its two main oil ports are closed and under control of one armed faction that expressed support for the presidential council.

Other fields have been closed by attacks by Islamic State, which took advantage of the chaos to expand its territory. Forces allied to the government are currently fighting to take back the city of Sirte from the group.

The NOC said it recognized the presidential council as the executive and also the parliament in the east, the House of Representatives. It would report to both bodies.

The NOC will unify its budget for the remainder of the financial year, it said, and will make infrastructure rehabilitation a priority. It plans to make its new headquarters in the eastern city of Benghazi.

(Writing by Patrick Markey; Editing by Ros Russell)