ROME – World powers said they persuaded some of Libya's feuding factions to form a national unity government and pledged to act against ISIL, which has spread to part of the North African country after years of deepening turmoil.

Secretary of State John Kerry, who co-chaired a peace conference in Rome on Sunday, told reporters after the talks that the expansion of the Islamic State in Iraq and the Levant into Libya had made the country "dangerous for everyone" and that Libyan representatives at the summit had pledged to sign a U.N.-brokered deal for a government of national unity Wednesday.

Calling the deal "the only legitimate basis for a solution" to the Libyan crisis, Kerry said that "those who disrupt a deal will pay a price for their actions."

Foreign ministers and officials from the five permanent U.N. Security Council members, as well as European and regional players, took a step in forging a road map for a way out of the civil war triggered by the fall and slaying of Moammar Gadhafi four years ago.

"We cannot allow the status quo in Libya to continue. It is dangerous for the viability of Libya, it is dangerous for Libyans, and now because of the increased presence of Daesh purposely fighting in there it is dangerous for everyone," Kerry said, using another term for ISIL.

Powers at the conference pledged to meet with a new Libyan government "rapidly" and study its requests for help in stabilizing the country. "We refuse to stand by and watch a vacuum being filled by terrorists," Kerry said, describing Libya as "a country of 6 ­million people which is not even capable of pumping the oil that is there."

Kerry said the national unity government was to be set up within 40 days of the agreement being signed. A statement by participants, released by the Italian Foreign Ministry, urged all parties to agree to an immediate cease fire.

"We express our determination, working together with the Government of National Accord, to defeat ISIL affiliates in Libya and eliminate the threat they pose to Libyan and international security," the statement said.