UNITED NATIONS — The five permanent members of the United Nations Security Council have agreed on a resolution that will require Syria to give up its chemical weapons, but there will be no automatic penalties if the Syrians fail to comply, officials said Thursday.

The agreement, hammered out after days of back-room negotiations, is a compromise among the United States, its allies and Russia about how to enforce the resolution, which would eliminate Syria’s chemical arms program.

But the deal, when approved by the 15 members of the Security Council, would amount to the most significant international diplomatic initiative of the Syrian civil war. It would also be a remarkable turn for President Obama, who had been pushing for a military strike on Syria just a few weeks ago before accepting a Russian proposal to have Syria give up its chemical arsenal.

Western diplomats said the resolution would be legally binding and would stipulate that if Syria failed to abide by the terms, the Security Council would take measures under Chapter 7 of the United Nations Charter, the strongest form of a council resolution. Such measures could include economic sanctions or even military action. But before any action could be taken, the issue would have to go back for further deliberations by the Security Council, on which Russia, like the other permanent members, holds a veto.