The United Nations General Assembly failed to pass a resolution condemning Hamas, serving a crushing defeat to Israel and its American ally after weeks of diplomacy.

While the US-backed draft resolution got a comfortable majority of votes, it fell short of the two-thirds super-majority needed to pass.

Eighty-seven countries voted in favour of the resolution, while 57 opposed it. Thirty-three countries abstained and another 23 were not present.

Israeli leaders still praised the outcome as a show of wide support for their position against the terror group, which for years has targeted Israel with rockets, bombs and other attacks.

“Today we achieved a plurality. That plurality would have been a majority if the vote had not been hijacked by a political move of procedure,” Israeli Ambassador to the UN Danny Danon said after the vote.

“But in one strong, courageous voice, we have brought Hamas to justice. For those member states that rejected this resolution, you should be ashamed of yourselves,” he said.

The resolution, entitled “Activities of Hamas and Other Militant Groups in Gaza,” would have condemned Hamas “for repeatedly firing rockets into Israel and for inciting violence, thereby putting civilians at risk.” It would have been the first General Assembly measure to specifically target the terror group, which is the de facto ruler of the Gaza Strip.

Among those to vote against the measure were China and Russia, while India abstained, despite forging recent warmer ties with Israel. The measure was widely welcomed in Europe and the Americas, including Argentina and Brazil.

Last week, the European Union agreed the bloc’s 28 countries would back the measure, after the US agreed to make changes to the language.