A US-sponsored resolution condemning militant group Hamas for firing rockets into Israel has failed to pass at the UN General Assembly.

The resolution won a majority of 87 to 57, with 33 abstentions, but did not reach the required two-thirds backing.

US envoy Nikki Haley had said adoption would right a "historic wrong" as the UN has not passed such a condemnation.

A Hamas spokesman said the outcome was a "slap" to President Donald Trump's administration.

Israeli PM Benjamin Netanyahu said that although the two-thirds was not achieved, this was the first time there was a "sweeping majority of countries " who had stood up against Hamas.

Resolutions at the UN can carry political weight but are non-binding.

This resolution was the first condemning Hamas that the 193-nation assembly had considered.

Ahead of the vote, Ms Haley, who steps down at the end of the year, said she wanted to "ask my Arab brothers and sisters - is the hatred toward Israel so strong that you'll defend a terrorist organisation? One that is directly causing harm to the Palestinian people?"

A vote to require a two-thirds majority was narrowly backed by 75 to 72, with 26 abstentions.

Israeli Ambassador to the UN Danny Danon said the resolution had been hijacked by this procedural decision.

Sami Abu Zahri, a spokesman for Hamas, the militant group that has ruled the Gaza Strip since 2007, wrote on Twitter after the vote: "The failure of the American venture at the United Nations represents a slap to the US administration and confirmation of the legitimacy of the resistance."

Iran's Deputy UN Ambassador Eshagh al-Habib said the US was trying to deflect attention away from the root causes of the conflict.

Last month saw a flare-up of violence between Israel and Palestinian militants in Gaza. Hundreds of rockets were fired into Israel, with Israeli aircraft hitting scores of militant targets in response.

Israel and Hamas have gone to war three times.

The Trump administration has been a strong supporter of Israel, recognising Jerusalem as Israel's capital and this year moving the US embassy there from Tel Aviv.