Just before he flew to Libya on Tuesday, the Turkish prime minister, Recep Tayyip Erdogan, was asked what he thought of the new European Union president who once remarked that Turkey could never be a part of Europe because it did not share the "fundamental values" of Christianity. Mr Erdogan had a diplomatic response ready: Herman Van Rompuy would pose no obstacle to the Muslim nation's EU aspirations.
Then he took off to Tripoli followed by a gaggle of businessmen, joined the Libyan leader Muammer Qadafi in his Beduoin tent and announced that the two nations would sign a free-trade agreement next year. Following the news that the colourless Mr Van Rompuy, a Belgian Eurocrat, was appointed to the presidential post, the question "who?" continues to echo from Westphalia to Manchester. But the Turks have grown used to hostility from the EU a leading columnist once called it a "fat midget" which was "lacking perspective" and gave a collective shrug.
Prospects for Turkey's accession to the exclusive European club may look dimmer than ever but the republic, which is Nato's only Muslim member, is increasingly turning eastward for its ambitions. From the Balkans to the Caucasus to the Middle East, Turkey is focusing its energies on establishing an arc of influence in many countries which were once part of the Ottoman empire. Some call it Ottomania.
But instead of rose-perfumed pashas in embroidered caftans invading Arab lands with cadres of janissaries, Turkish politicians are arriving with delegations of business leaders dangling lucrative trade deals to the economically stagnant region. "Turkey is carrying western values to its eastern neighbours," said Mustafa Kutley, an Ankara-based contributor to the Turkish Weekly journal. "It is trying a very European approach: while increasing the wealth of its country it is transforming the continent from one of violence to one of wealth. That is what Europe once did. The EU is less important on the Turkish agenda."
Ever since the Turks established a secular republic in 1923 by abolishing the caliphate, they have looked down their noses at the backwardness of the east and preferred to turn to Europe and America for role models. But that is changing at breakneck speed. In the past two months Turkey's somewhat Islamist leaders from the ruling AK party have travelled to Iraqi Kurdistan and promised to open a consulate in Irbil.
The Iranian president, Mahmoud Ahmadinejad, may have declared earlier this month that capitalism was dead, but the two countries which once ran rival empires have reached a deal to increase bilateral trade from US$7 billion (Dh25b) in 2008 to $20 billion by 2011. Turkey has cannily capitalised on anti-American sentiment in Iraq and signed a raft of deals there. Indeed Turkish exports to the Middle East and North Africa were valued at $31 billion in 2008, a seven-fold increase from 2001.
The Turks are making their mark on the diplomatic scene, too. In trying to mediate between Iran and the West, Turkey is offering to store Iran's low-grade enriched uranium. Relations with Israel are cold but last week a trade minister from the Jewish state visited Turkey and the two sides promised to improve ties. More significantly, last month Turkey and Armenia agreed to open their border and establish diplomatic ties despite lingering hostility over the genocide of up to one million Armenians at the hands of Ottoman Turks in 1915.
It was a coup for Turkey's so-called "football diplomacy" in which leaders from the two countries met occasionally to watch their national teams play football, providing a casual setting for negotiations. A decade ago, the Turks and the Syrians nearly went to war but last month Mr Erdogan and the Syrian president, Bashar al Assad, were practically hugging in Damascus as they announced that visa requirements for travellers would be abolished.
Russia, another historic enemy, is now a major trading partner. The driving force behind the change is Ahmet Davutoglu, the scholarly foreign minister who was Mr Erdogan's chief foreign policy adviser for seven years before he took up the ministerial job. The son of a merchant from Anatolia and an outsider to the Ankara-Istanbul elite, Mr Davutoglu has torn up decades of Turkish policy in reaching out to former Ottoman dominions.
Sometimes the results are startling. Last February when his predecessor, Ali Babacan, visited Yemen he was greeted by a room full of tribal leaders with their daggers drawn. It was an old custom reserved for the arrival of Ottoman governors. Mr Davutoglu, who is nicknamed the "Kissinger of Turkey" in reference to Henry Kissinger, the former US secretary of state, prefers the term "strategic depth" to Ottomania.
His slogan is "zero problems with neighbours". Mr Davutoglu is a supporter of the EU project but unafraid to defend the Ottomans to European audiences. "If the Ottoman archive was not opened, European history could not have been written," he told a Spanish newspaper earlier this month. Turkey has also become an important energy hub. The most visible project right now is the Nabucco pipeline, a proposed $11.7 billion plan to carry gas across Turkey from Azerbaijan and perhaps Turkmenistan, Iran, Iraq and Egypt.
These developments have caused some anxiety in the West because of fears that Turkey is drifting away from its traditional allies. Turkey's chummy relations with Iran will certainly be brought up in Washington when Mr Erdogan visits the US on December 7, said Hugh Pope, an Istanbul-based expert on Turkey and author of the upcoming Dining with al Qaeda: Three Decades Exploring the Many Worlds of the Middle East.
"The way Erdogan is talking about Iran is definitely damaging him in Washington policy circles and perhaps irritating people in the EU. But I think there are valid counter-arguments. The Turks are saying 'at least we are engaging Iran'. A million Iranians are coming to Turkey every year and seeing an alternative way of governing in a developing country with a Muslim identity. This is possibly more subversive in Iran than any sanctions could be."
Iranians are joined by a growing number of Arabs flocking to the beaches and pine forests of Turkey's south-west coast during the summer holidays. Tourism has also been given a boost thanks to Muhannad, the dashing male lead in the hit Turkish soap opera Noor which is dubbed into Arabic and broadcast across the Arab world to swooning female audiences. There have been missteps though. Earlier this month Mr Erdogan raised hackles by defending the Sudanese president, Omar al Bashir, who is wanted by the International Criminal Court on war crime charges. "A Muslim could never commit genocide," the prime minister said. There is also the thorny question of languishing peace talks between Greek and Turkish Cypriots in Cyprus.
Still, there is a confidence partly drawn from its history which did not exist before. "The Ottomans weren't seen as a constructive part of Turkey's past. It was not natural because Ottoman history is part of Turkey history," said Mr Kutley. "It is about making peace with its history." The high-water mark perhaps came in September during the funeral of the last Ottoman prince, Osman Ertugrul Osmanoglu, at the Blue Mosque in Istanbul. He would have been successor to the 600-year-old dynasty if the empire had not been abolished.
The government granted special permission to allow him to be buried next to his grandfather, Sultan Abdul Hamid II. Several ministers attended the service, which would have once been unthinkable in the fiercely secular republic. The nostalgia is also apparent at the populist level. A popular new museum depicting the 1453 capture of Constantinople by Mehmet II has opened in the capital. The centrepiece depicts his final victory on the city walls. In January, Istanbul will have the opportunity to show off its new-found confidence when it holds the title of European Capital of Culture.
The occasion will be marked by a year-long series of museum openings, concerts and exhibitions among other events. Ironically, the accolade was given by the European Union. "Istanbul is already a city with international stature and has been from the first day it was founded," said Yeshim Ternar, the Turkish-born author of The Book and the Veil Escape from an Istanbul Harem. "It has always been a nexus; a wonderful mix of everything that fuels culture. There is no other city in the whole world that disorients a traveller and where any effort at reorientation brings you somewhere you had never imagined was possible."
For some it was high time the Middle East looked to Turkey for a fresh approach to solving the region's problems. Pope said: "We're seeing something based on Istanbul as a hub, and a commercial prestige of Turkey at the moment. Middle Eastern countries are looking to Turkey for ideas." @Email:firstname.lastname@example.org