(Adds comment by U.N. Security Council)
TUNIS, Dec 11 (Reuters) - Libya's rival factions on Friday agreed to Dec. 16 as a target date for signing a United Nations-backed national unity government agreement meant to end their conflict.
The U.N. has been negotiating for a year to get Libya's two rival governments and armed factions to end their war that has plunged the North African state into chaos four years after rebellion ousted Muammar Gaddafi.
Successfully signing an agreement would open the way for the international community to support Libya in the fight against Islamic State, which has gained ground in the chaos and controls the western city of Sirte.
But hardliners in both camps have been resisting a deal. Several past deadlines to sign have fallen through after opponents balked at details or demanded more concessions from their rivals.
"There was a wide consensus that only through rapid signature of the Libyan political agreement the country can be brought back to unity," U.N. Libya envoy Martin Kobler said in Tunisia after two days of talks.
"Many problems remain, but this has to be solved by the new government in place. That's what governments are there for," said Kobler. He briefed the United Nations Security Council on the situation later on Friday.
The 15-member council said that a unity government must be formed swiftly to counter the threat of Islamic State militants.
U.S. Ambassador to the United Nations, Samantha Power, council president for December, said the body remained prepared to sanction those "who threaten Libya's peace, stability and security."
For more than a year, Tripoli has been controlled by an armed faction called Libya Dawn, a coalition of former rebel brigades from Misrata and other armed factions in the capital, after they battled to force out rivals.
They set up a self-styled government and reinstated the old parliament, known as the General National Congress. The internationally recognized government and the elected House of Representatives were forced to operate out of the east.
Both factions are backed by loose alliances of former rebel brigades, tribal fighters and former Gaddafi soldiers, including Gen. Khalifa Haftar, who has been appointed armed forces commander by the government in the east.
Helping to bring those military factions on board, training up a national army and providing assistance in dealing with Islamic State will be where the international community will look to help Libya if a unity government is formed.
Libya's oil output is also now at less than half of the 1.6 million barrels per day that it produced before Gaddafi fell, leaving the central bank and state oil company struggling to manage an economy heavily dependent on crude.
"The time has come to sign the agreement," Libya's U.N. Ambassador Ibrahim Dabbashi told the Security Council. (Reporting by Patrick Markey and Michelle Nichols; Editing by Richard Balmforth, James Dalgleish and Andrew Hay)
Our Standards: The Thomson Reuters Trust Principles.