The "brutal" recent beheading of 21 Egyptian Christians by militants affiliated to the Islamic State group demonstrated "once again the urgent need for a political solution to the conflict," a statement issued in the name of the United States, Britain, France, Germany, Italy and Spain said, according to an Italian version of the text released by the foreign ministry in Rome.
The governments condemned all acts of terrorism in Libya and said a UN-sponsored attempt to get the country's warring militias to a negotiating table with the aim of forming a government of national unity was the "best hope" for peace in the country.
"The international community is ready to fully support a national unity government to meet the current challenges faced by Libya."
They said UN envoy Bernardino Leon would be holding meetings in the coming days with parties in Libya to try and rally support for a unity government.
Those who did not take part would be excluding themselves from a political solution which has become an urgent necessity because of the terrorist threat, the statement said.
It added that anyone who failed to help save Libya from extremism and chaos would be held responsible by the Libyan people and the international community for their actions.
The statement came ahead of a UN Security Council meeting on Libya on Wednesday.
Egypt, which has already carried out retaliatory airstrikes against IS targets in Libya over the murders of its nationals, has asked the Council to provide a mandate for international intervention in its neighbour.
Italy, the European country most exposed to the overspill from the chaos in Libya, raised speculation about possible western intervention last week when two senior ministers made noises about being "ready to fight" and commit troops to combat the terror threat.
But Prime Minster Matteo Renzi has since quashed such talk, insisting that any intervention will only come after all political and diplomatic avenues are exhausted and with full UN authorization.
At an emergency meeting of his security committee on Tuesday, Renzi approved plans first outlined last week to raise the number of troops stationed at potential terror target sites across the country from 3,000 to 4,800 as part of a "safe streets" initiative.
Italy has been urging its allies for months to take a closer interest in events in Libya. The breakdown of government in the former Italian colony has contributed to a dramatic increase in the number of African and Middle Eastern migrants and refugees arriving in Italy by sea after transiting through Libya.