Lucas Jackson/REUTERS
Turkey was, it appeared, in the driving seat to be one of five new non-permanent members of the UN Security Council.
"We believe, God permitting, that we will get the result of the work we put in" asserted Turkey's new Foreign Minister Mevlut Cavusoglu, speaking from Turkey's pre-election gala at the Waldorf-Astoria Hotel in New York.
Although the delegation had loosely been assured of around 140 votes from the UN General Assembly, what transpired seemed to take everybody by surprise with Turkey departing the race in the third round with a mere 60, some distance short of the 129 required to triumph.
In its stead New Zealand and Spain took the two available places, and will from January 1st enjoy the prestige of being members of the Security Council for two years. Back in Turkey, for a government unacquainted with losing hard-fought elections, soul-searching is required.
The Security Council is the UN's most powerful body, focusing on worldwide peace and security. Five countries hold permanent seats, while ten seats are given to other countries on a rotational, elected basis. While the US, UK, France, China and Russia hold continual positions with full powers plus veto rights, ten other countries with temporary positions are able to make proposals, lobby other members, and vote.
This year five countries - Angola, Venezuela, Malaysia, and Turkey's victors New Zealand and Spain - will replace the previous incumbents in a little over two months. Some of these countries that ended up winning have similar or worse human rights records and anti-democratic records to Turkey, and before the vote it appeared that the Turkish delegation was going to get its way.
The delegation had been verbally stipulated of around 140 votes, but from a total of 191 available votes it certainly seemed surprising when Spain too had around 150 agreed upon. In an anonymous voting contest, promises are easy to make - but why were these ones so difficult to keep?
Ahmet Davutoglu, Turkey's new Prime Minister, seemed bullish prior to the vote. "If we are elected, and we believe it's a great possibility, we will be the first country in the world to be elected for a second time, after a five-year break. This shows Turkey's importance." Turkey won 151 votes in the same contest in 2009, and Davutoglu had some strong reasons for believing in a similar success this time around.
Pivotal geo-politically, encompassing a number of new oil and gas pipelines, a founding member of the UN and a member of G20, Turkey has generally won plaudits for its recent building of relatively humane refugee camps that house an estimated 1.6 million Syrian refugees.
The world's 17th highest GDP has emerged from the past five years of global economic crisis quite unscathed, and has been trying to take a much more pro-active stance in the region since 2010.
Newly inaugurated President Recep Tayyip Erdogan, as Prime Minister was consistently a vocal opponent of Syria's dictator Bashar al-Assad, and until quite recently this mirrored prevalent world opinion. But as this opinion evolved, Turkey's unchanging stance was landing it in hot water.
As the situation in Syria has unearthed new power dynamics, Erdogan's stubborn anti-Assad and anti-Kurdish position has started to irk those who recognize a differing political landscape painted by the newly empowered Islamic State (IS).
Although Turkey has finally started making some concessions to the US, and is now somewhat ostensibly assisting the Kurds in the fight against IS, its overall mixed response to the situation has drawn worldwide indignation.
Erdogan has at times seemed more interested in overseeing the destruction of the Kurds, and state border guards have been allowing IS fighters into Turkey for medical treatment while not allowing Kurds from Turkey across the border to assist their brethren in the battle against IS at Kobane. While the General Assembly vote was underway, Turkish fighter jets were bombing a Kurdish village.
It appears that Erdogan's obstinacy and pro-Sunni position has prevented him from realizing that Assad needn't be the main target for the moment - and worldwide opinion seems to suggest that the growth of the openly barbaric and power-hungry IS is of greater concern.
The Spanish daily newspaper El Pais said that "what is important in the UN is not so much about having friends as having fewer enemies " - and Turkey has been busy making enemies all over the region and beyond. While an anti-Turkey campaign can always be counted on from Armenia, Cyprus and Greece, due to historical wounds that were never healed, and while they haven't been able to count on the vote and lobbying influence of Israel since a falling-out in 2010, other countries in the region have started to pile on the pressure.
An Embarrassing Loss
Middle Eastern countries such as Egypt and Saudi Arabia lobbied hard against Turkey for its pro-Muslim Brotherhood stance, while Shia-dominated countries are concerned with how Erdogan is rabble-rousing to focus minds on Sunni-Shia sectarian divides. Erdogan has professed support in the past for Sunni militants such as IS and Al-Nusra.
Beyond Turkey's immediate neighborhood yet more influence is being lost. A bitter quarrel between Erdogan and his former ally, the popular preacher Fetullah Gulen put paid to much of the African vote. Gulen has a powerful following worldwide, particularly in Africa, with a lot of schools, charities and influence.
TURKEY-GULEN/ REUTERS/Selahattin Sevi/Zaman Daily via Cihan News Agency
For the past 18 months he and Erdogan have been at war, with Erdogan trying to shift his supporters out of the public domain and otherwise diminish his capabilities inside and outside of Turkey. By way of vengeance it seems that the Hizmet organization has triumphantly campaigned against Turkey this time around.
Losing clout in these regions might not have dealt the Turkish delegation a mortal blow, had other aspects of Erdogan's governance been popular worldwide. But the way the country is being managed is causing concern, with well-documented evidence of increased anti-democratic behaviour.
While this hasn't prevented Venezuela or Angola from entering the Security Council, it seems to have helped tip the balance for a lot of General Assembly members.
Turkey always had a difficult hand to play, as it is rather unusual to be voted onto the Security Council twice in four terms, and needed a watertight campaign. A change of tactics regarding Syria, a less bellicose voice in the region, and some sort of truce with Gulen, would have helped matters tremendously.
"We will not abandon this stance for the sake of votes. We will continue to be the voice and conscience of countries that expect this from us" said Cavusoglu, odd considering the money and efforts invested in victory.
But Turkey ought to relish the election in 2018 against Israel, Germany and Belgium, and perhaps now would be an opportune moment for rumination.
Erdogan was very keen on this victory, and needs to examine the reasons for defeat. The question is, are the characters involved capable of the kind of soul-searching needed to understand and deal with their mistakes?
Blaming meddling outsiders, protesters, Israel, journalists, or even the "Interest Rates Lobby", seems to suffice to his own supporters. But as we learned this week, the rest of the world isn't so easily duped.