ROME (Reuters) - Global powers on Sunday backed the formation of a national unity government in Libya, pledging economic and security support to help stabilize the chaotic North African country where Islamic State militants have a foothold.

U.S. Secretary of State John Kerry and Italian counterpart Paolo Gentiloni, joined by U.N. envoy Martin Kobler, were optimistic that the majority of the representatives of Libya’s two rival governments would sign a unity deal on Dec. 16.

Representatives from 17 countries including Egypt, Germany, Russia, Turkey, and China signed a joint statement calling for an immediate ceasefire and promising to cut off contacts with factions that do not sign the deal.

Fifteen Libyans from different groups also attended the meeting. Past deadlines have slipped amid internal disagreements in the sprawling, oil-producing country rife with armed groups.

“We stand ready to support the implementation of the political agreement and underline our firm commitment to providing the Government of National Accord with full political backing and technical, economic, security and counter-terrorism assistance, as requested,” the statement said.

Both Kerry and Gentiloni, who co-chaired the meeting, appeared confident a deal was around the corner, and stressed that a unity government was needed also to fight the growing threat from Islamic State militants.

“The message of today’s meeting is clear,” Gentiloni said. “What matters is the stabilization of Libya because this too can contribute to the fight against terrorism.”

Libya has sunk deeper and deeper into chaos since a Western-backed rebellion toppled Muammar Gaddafi four years ago.

The OPEC member now has two rival governments and two parliaments each backed by competing armed factions. Divisions over the U.N. deal are raising questions about how opponents will react to any new government in the capital Tripoli.

Slideshow ( 8 images )

Former colonial power Italy has sought to focus international attention on the OPEC country’s drift toward anarchy, particularly since last month’s deadly Islamic State attacks in Paris. Libya is less than 300 km (190 miles) across the Mediterranean Sea from the Italian island of Lampedusa.

ISLAMIC STATE

With around 3,000 fighters, Islamic State has solidified its foothold in Libya by taking over the central city of Sirte. It has attacked a hotel and a prison in Tripoli, oil fields and military checkpoints, and issued a video of its militants beheading 21 Egyptian Christians on a Libyan beach.

The U.N. brokered agreement would allow a new Libyan government to ask for international military assistance to fight Islamic State’s growing presence.

The recognized government and elected House of Representatives have operated only in the east of Libya since last year, when the capital Tripoli was seized by a faction that set up its own government. Each side is backed by competing alliances of former anti-Gaddafi rebels.

Both of Libya’s rival parliaments are splintered between those who support or reject the U.N. deal. Moderates in the two camps back the accord, but Western officials blame the presidents of both legislatures for blocking a vote.

Some representatives of Tripoli-based GNC parliament said GNC delegates attending the Rome talks did not represent their self-declared government.

“In my opinion, the U.N.-brokered political agreement will die just like the Rome conference will after today,” GNC lawmaker Abdulqader Hawaili told Reuters.

Slideshow ( 8 images )

The U.N. proposal calls for a presidential council with the House of Representatives as the legislature alongside a second consultative chamber, the State Council.

The presidential council could form a government in 30 days once a deal is signed and that would be ratified by parliament and bolstered by a U.N. Security Council resolution.

“We are prepared to meet with (the national unity government) rapidly in order to facilitate their capacity to govern,” Kerry said, addressing the country’s fragmentation.

Any government faces huge challenges, with the oil industry reeling from attacks and protests. Output is less than half of the 1.6 million barrels per day the OPEC state had before 2011.

Western officials do not rule out more unilateral air strikes on militants. The United States has carried out air strikes and France has conducted surveillance flights.

But with most in the West opposing troop deployments on the ground, initial efforts will likely focus on training and aiding local forces.