It began so nobly eight years ago, with exhortations to rid the world of nuclear weapons, and idealistic musings about turning Arabs and Americans into brothers, all capped by an absurdly premature Nobel peace prize. The Obama foreign policy era, however, is ending very differently: in a fit of two-fingered pique at the United Nations against Israel and its prime minister Benjamin Netanyahu. The loser, though, won’t be Israel or Netanyahu; if anything, it’ll be the UN.

The pique, of course, won’t make a scrap of difference. The only criticism a rational individual might make of Obama’s decision to allow the now notorious Security Council resolution condemning Israeli settlement expansion to pass is, “What took you so long?” Israeli settlement expansion has for decades been a thorn in the side of US presidents trying to broker Middle East peace. The otherwise unanimous passage of the resolution only proves how the rest of the world overwhelmingly feels that way as well.

But then again, even harder for a rational individual to fathom is Congress’s unquestioning lockstep support for Israel – support that Netanyahu has brazenly exploited in his years of feuding with Obama. Brave indeed is the Representative or Senator who dares criticise the Jewish state.

In any case, Donald Trump is riding to the rescue. Having nominated the most pro-settlement US ambassador to Israel in generations, the next president looks set to pursue policies that will delight Netanyahu and the far-right factions on whom he relies to stay in power. Come 20 January, Obama’s gesture will be forgotten. Not so, however, the role of the UN in the affair – at least on Capitol Hill.

John Kerry lays into Netanyahu for Israeli settlement-building

Washington’s relationship with the world body 220 miles to its north has often been strained. All too often, the United Nations comes across here as a gang of third world countries getting one back on the biggest kid on the block. The UN was clearing house for opposition to the younger Bush’s invasion of Iraq. Washington has used its power to force out secretaries generals it did not like, and on occasion refused to pay its dues (some 22 per cent of the total UN budget).

But of late the going has been smoother. Obama has probably been the most multilaterally minded American president of modern times, and the least inclined to throw his country’s weight around. Three weeks hence, however, things will be very different.

A populist, unabashedly “America First” administration is about to take office, unlike anything the country has seen before. It will be led by a president whose approach to diplomacy will be transactional, and who has an abiding dislike of freeloading international bodies living off on the American shilling.

Judging by Trump’s rhetoric on the campaign trail, Nato – that ungrateful group of allies protected by US military might but who were unwilling to pay a fair share for that protection – had seemed first in line for the treatment. After the Israel vote, that dubious distinction may have passed to the softer target on the banks of the East River.

For the Washington establishment, Nato remains an article of faith. Not so the UN. Washington is but one of five veto-wielding permanent members on the Security Council. Lopsided votes against US policies on Israel and Cuba have been a constant source of embarrassment. And then there’s the paranoid far-right fringe, haunted by visions of black UN helicopters swooping down to take away America’s sovereignty. One may presume it mostly voted for Trump.

The Israel vote has got the old juices running. Cut back America’s contributions, say some on Capitol Hill. No, suspend them entirely say others. Why not pull out entirely, even argue a few. After all, the UN needs America much more than America needs it. And the UN never does anything anyway.

Which is, of course, nonsense. Yes, the UN can give a very decent impersonation of bureaucratic ossification, and the incidents of sexual abuse perpetrated against civilians by certain of its peacekeepers are shocking and indefensible. But these peacekeepers, whatever their inadequacies, are carrying out missions that otherwise might have fallen to the US. And to blame the UN for failing to resolve the great crises of the day is absurd.

Gaza marks 10 years of Israeli blockade

The UN is only as effective as its members – in practice the big five powers with the right of veto on the Security Council – allow it to be. If the US and Russia, for instance, cannot agree on a peace plan for Syria, war will continue, stymieing the humanitarian efforts of the UN in the process. Into this dysfunctional club now barges Donald Trump, full of talk about pulling the US out of the UN climate deal and the UN-monitored Iran nuclear deal.

As for America not needing the UN, that too is nonsense. Just like his predecessors, Trump will find the world body, for all its deficiencies, a precious forum for negotiation and a vital source of legitimacy (as, for example, for the US-led coalition that drove Iraq from Kuwait in 1991). Dealing with it won’t be easy; indeed it will often be maddeningly frustrating. But it will be worth it.

And who knows? Things might just work out. Trump’s choice of ambassador is no fire-breathing, tear-down-the-building radical. Nikki Haley, the outgoing governor of South Carolina, may be a diplomatic novice, but she’s young, a highly talented politician and a relative moderate by the standards of the Trump team. And by odd coincidence, for the first time since 1953 a new US President and UN Secretary-General will be taking office at the same time.

Antonio Guterres, an admired former prime minister of Portugal and the longest-ever serving UN High Commissioner for Refugees, has the makings of a highly effective leader of the UN. Re-establishing the credibility of the organisation in Washington will demand every ounce of his skill. Even then the UN’s performance – as always – will depend not on him, but on the willingness of its most important members to make the world body work.