UNITED NATIONS—The U.N. General Assembly on Thursday rejected a U.S. resolution condemning Hamas as a terrorist organization, delivering a blow to Ambassador Nikki Haley’s parting action before leaving her post at the end of the year.

The vote was the first time that the General Assembly was considering a resolution regarding Hamas, the Palestinian movement controlling the Gaza Strip since 2007. The resolution condemned Hamas and called for an end to violence.

The U.S. mission had negotiated for weeks with countries and had succeeded in getting all 28 countries of the European Union bloc on its side. The U.S. and European Union have already designated Hamas as a terrorist group for its indiscriminate targeting of Israeli civilians with rockets and suicide bombs.

The resolution fell short of the required two-thirds majority of the 193-member assembly to pass, with 87 votes in favor, 57 against and 33 abstentions. The U.S. had earlier sought a simple majority.

“There can be no peace without the mutual agreement that terrorism is unacceptable,” Ms. Haley told the assembly. “The questions before us is whether the U.N. thinks terrorism is acceptable if and only if it’s directed at Israel.”