Thomas M. Countryman, the assistant secretary of state who led the American delegation, said that the United States would support the treaty in the General Assembly based on the fact, he said, that the pact would promote global security, advance humanitarian objectives and curb illegal arms sales, all without affecting the constitutional right to bear arms.

Although opposition from Iran, North Korea and Syria had been expected, diplomats and outside proponents of the treaty had hoped the three countries would not block an accord that so many sought. All three belong to the roughly 120-member Nonaligned Movement — Iran is its current president — and the bulk of its members in Africa and Latin American strongly backed the treaty.

But in the end, the three went with their domestic concerns. They are each subject to arms embargoes already, and were concerned that the treaty would add muscle to such blockades.

After the consensus failed, one delegate after another, notably from Africa and Latin America, took to the floor to express disappointment that just three countries had stalled a treaty aimed at curbing violence globally.

Their frustration was echoed by rights groups that have long sought such a treaty. “The world has been held hostage by three states,” said Anna Macdonald, the head of arms control at Oxfam. “We have known all along that the consensus process was deeply flawed, and today we see it is actually dysfunctional.”

In rejecting the treaty, the Iranian ambassador, Mohammad Khazaee, said it left too much in doubt.

“While the rights of arms-exporting states is well preserved in this text,” he said, “the right of importing states to acquire and import arms for their security needs is subject to the discretionary judgment and subjective assessment of the exporting states.”

He said that the measure would leave the sale of conventional weapons covered by the text “highly susceptible to politicization, manipulation and discrimination.”