ROME - Diplomats fearful of advances by Islamic militants in the chaos of Libya endorsed a plan Sunday for a cease-fire and a national unity government, potentially paving the way for the North African country to receive support and arms from a host of foreign countries.

"We refuse to stand by and watch a vacuum filled by terrorists, because all of us are unwilling to help people who want their freedom, want their independence, want their country back," said Secretary of State John Kerry, who, together with Italian Foreign Minister Paolo Gentiloni, cochaired a summit aimed at stopping Libya's slide into anarchy.

Kerry joined 20 other diplomats from Europe, Africa, and the Middle East to address mounting concern that Libya is about to become, as Italian Prime Minister Matteo Renzi recently said, "the next emergency" after Syria.

They talked with 15 officials from both of Libya's rival governments, all of whom were part of a tentative power-sharing agreement scheduled to be signed in Morocco on Wednesday. The Rome meeting's goal was to reassure them that if they follow through and a majority in both parliaments sign the agreement, foreign aid would be forthcoming.

A joint statement issued after the conference urged "all parties to accept an immediate, comprehensive cease-fire in all parts of Libya" and pledged economic, security, and counterterrorism assistance for the unity government, the Associated Press reported.

The diplomatic efforts offer the brightest hopes yet for an end to the mayhem that has overwhelmed Libya since Moammar Gadhafi was deposed and killed in 2011. Libya is now a bifurcated state, with an internationally recognized government in Tobruk and a parliament backed by Islamist militias in the capital, Tripoli.

Italy, Libya's former colonial power, called the conference. It is particularly concerned about threats posed by the North African country only 180 miles off its coast. The proximity has made Libya a jumping-off point for tens of thousands of refugees heading to Europe.

According to a recent U.N. report, 2,000 to 3,000 Islamic State fighters are now in Libya. The Islamic State already controls Sirte, Gadhafi's hometown, but it has faced "resistance from armed residents," the U.N. report said.

A new government that could counter the IS advance is finally on the horizon. After more than a year of U.N. mediation efforts, a majority of lawmakers from Libya's two rival parliaments appear to have tentatively decided to share power. If they sign the agreement Wednesday, a new government would be formed within 40 days.