(CNN)The United Nations voted overwhelmingly to condemn President Donald Trump's decision to recognize Jerusalem as the capital of Israel despite threats from the US to pull funding from the world body.

Some 128 countries voted for the resolution, while nine voted "no," and 35 nations abstained, including Canada, Mexico and Australia.

The vote came after US Ambassador to the UN Nikki Haley issued a direct threat, saying that the US will think twice about funding the world body if it voted to condemn Trump's decision.

"The United States will remember this day in which it was singled out for attack in this assembly," Haley said. "We will remember it when we are called upon to once again make the world's largest contribution" to the UN and when other member nations ask Washington "to pay even more and to use our influence for their benefit."

Haley said the US will put its embassy in Jerusalem regardless of the vote.

Read More

"That is what the American people want us to do and it is the right thing to do," Haley said. "This vote will make a difference in how Americans look at the UN," she said. "And this vote will be remembered."

Haley's remarks followed a threat from Trump himself, who mentioned the UN vote at a Wednesday Cabinet meeting. "We're watching those votes," the President said. "Let them vote against us, we'll save a lot. We don't care."

Later Thursday an invitation was sent around to the 64 countries in addition to the US that did not support the resolution on Jerusalem, to attend a reception with Haley in January. The event was labeled as a means to thank the countries for "their friendship to the United States," according to a copy of the invite obtained by CNN.

Few countries seemed cowed, as nation after nation blasted the US at the emergency session of the UN General Assembly, condemning the Jerusalem decision as illegal, destabilizing, and a violation of international law.

Haley's stance also provoked a fiery tweet from John Brennan, who served as CIA director under President Obama: "Trump Admin threat to retaliate against nations that exercise sovereign right in UN to oppose US position on Jerusalem is beyond outrageous. Shows @realDonaldTrump expects blind loyalty and subservience from everyone—qualities usually found in narcissistic, vengeful autocrats."

Trump Admin threat to retaliate against nations that exercise sovereign right in UN to oppose US position on Jerusalem is beyond outrageous. Shows @realDonaldTrump expects blind loyalty and subservience from everyone—qualities usually found in narcissistic, vengeful autocrats.

The US was joined in its "no" vote by Israel and a slew of small nations, including Micronesia, Nauru, Togo and Tonga, Palau, the Marshall Islands, Guatemala and Honduras.

Other abstainers included the Czech Republic, Poland, Hungary, Croatia and South Sudan.

Israeli Prime Minister Benjamin Netanyahu thanked Trump and the countries that abstained in a statement issued shortly after the vote.

"Israel rejects the decision of the United Nations and, at the same time, we show gratitude to the high number of countries that abstained from this resolution," Netanyahu said. "Israel thanks President Trump on his unequivocal position in favor of Jerusalem and thanks other countries that voted together with Israel, together with the truth."

In the aftermath, Haley's office said the support the US did get counted as a victory of sorts, pointing out that nine countries voted against, 35 countries abstained, and 21 were absent.

"While the resolution passed, the vote breakdown tells a different story," a spokesman for the US mission said. "It's clear that many countries prioritized their relationship with the United States over an unproductive attempt to isolate us for a decision that was our sovereign right to make."

Before the vote, at least one world leader took the time to call out Trump directly.

Turkish President Recep Tayyip Erdogan, a self-styled leader of the greater Muslim world, blasted the President during a speech in Ankara on Thursday.

"What is the cradle of democracy doing?" Erdogan said. "They are looking for people they can buy with their dollars." And he issued an appeal to other world leaders, saying, "do not, for the sake of a few dollars, sell off your democratic free will."

State Department spokesperson Heather Nauert said the US would "explore various options" following the UN vote. Nauert said the White House and NSC told the State Department on Thursday afternoon that "the President's foreign policy team has been empowered to explore various options going forward with other nations, however no decisions have been made."

Nauert also said that "the UN vote is really not the only factor the administration would take into consideration in dealing with our foreign relations."

But at least one UN analyst said that the US threats about funding had an element of political theater about them, noting it would be hard for the US to pull support from countries such as Yemen, Pakistan or Afghanistan, and that the threats weren't likely to sway votes.

On issues relating to Palestinians, the US and Israel always either find themselves in a minority, or with a handful of other friends like the Marshall Islands in the face of overwhelming majorities in the General Assembly, said Richard Gowan, a New York-based UN expert at the European Council on Foreign Relations.

And despite the threats from Trump, "There's safety in numbers for most members of the UN," Gowan said.

"Smaller countries, poorer countries may get a little nervous when they hear the President's rhetoric," said Gowan, "but they will also gain confidence that all the big members of the Arab bloc are pretty much guaranteed to vote against the US position, as well as the Europeans."

US officials say the decision to recognize Jerusalem and move the US embassy there from Tel Aviv reflects the basic reality. Israel's seat of government sits in Jerusalem, say US officials who add that their decision has no bearing on a final resolution of the conflict between Israelis and Palestinians, or on the fate of holy sites of the world's three largest faiths.

The fate of Jerusalem is so fraught, however, that it is considered a "final status" issue, only to be decided at the end of Israeli-Palestinian peace talks. No country bases their diplomatic mission in Jerusalem as a result.

Apart from Israel, none of the US' closest allies spoke before the vote. "No General Assembly resolution will ever drive us from Jerusalem," said Israel's Ambassador to the UN, Danny Danon. "The United States simply stated a fact. They officially declared what has always been true. Jerusalem always has been and always will be the capital of Israel."

"Those who support this resolution are like puppets," Danon said, "puppets controlled by the strings of your Palestinian masters."

Otherwise, speaker after speaker at the UN emphasized US isolation, with the Palestinian representative declaring that the decision destroyed Washington's ability to act as a mediator in peace talks and left it with few allies by its side.

"What does this decision serve?" asked Ambassador Riyad Mansour. "It serves the Israeli government in implementing its colonial plans. It serves the powers of extremism ... Does the United States not wonder why it stands isolated," Mansour asked, "and why even its closest allies couldn't turn a blind eye to this decision?"

"The world is not for sale," said Venezuela's representative to the UN, Samuel Moncada Acosta, "and your threats imperil global peace."

"This decision is an outrageous assault to all universal values," Turkey's Foreign Minister Mevlut Cavusoglu said. "This is bullying," he said of the US approach. "We will not be intimated." And addressing the US directly, he added, "you can be strong, but this doesn't make you right."

Maleeha Lodi, the Pakistani representative to the UN, said, "we regret and reject" the decision. "We must uphold the prevalent and time-honored norms, both legal and moral," she said. The world "cannot and will not be complicit in any illegal activity."

Turkey co-sponsored with Yemen the draft resolution which calls on all countries to refrain from establishing diplomatic missions in Jerusalem. Any decision that alters the character, status or demographic composition of Jerusalem should "have no legal effect, are null and void and must be rescinded in compliance with relevant resolutions of the Security Council," it reads.

Some polling counters Haley's claim that the decision to move the embassy reflects the will of the US people. A University of Maryland Critical Issues poll released December 1 found that 63% of Americans oppose moving the embassy to Jerusalem, including 44% of Republicans. The pollsters questioned 2,000 people and had a margin of error of 2.19%.

A December 13 Monmouth University poll that found Trump at record low approval ratings also found that 39% of Americans thought moving the embassy to Jerusalem was a bad idea, while only 23% thought it was a good idea. Some 51% of respondents said it would lead to greater regional instability, while 10% said it would make the region more stable.

Correction: This article has been updated to reflect that 64 countries other than the US did not support the UN resolution and the fact that Turkey's Foreign Minister Mevlut Cavusoglu spoke at the UN.