Turkey's dilemma over Syrian unrest
Two years ago, Israeli commentators noted what they saw as an alarming development. Turkey and Syria announced that they had just held their first joint military exercise.
It seemed to presage an extraordinary strategic shift by Turkey, whose million-strong army has been part of the Nato alliance since 1951, and which bought much of its equipment from Israel.
Coming in the same year that Prime Minister Recep Tayyip Erdogan launched an emotional verbal assault on Israel over its operations in Gaza, and when a scheduled joint exercise with the Israeli air force in Turkey had been abruptly cancelled, Israelis feared they were witnessing the creation of a new hostile alliance to the north.
In the end, although the Syrians made much of the "exercise", Turkish officials explained that it had amounted to little more than a small number of troops on either side of the border, trying to communicate with each other through radios, with mixed success.
What Mr Erdogan's government did do was apply the same formula for improving its relations with Syria that it has with most other neighbouring countries. This involved high-level, reciprocal visits by the leaders of both countries, accompanied by large delegations of ministers and entrepreneurs, the abolition of visa requirements and a flurry of trade agreements.
It fitted the governing AK Party's foreign policy vision, one that emphasised normalising once-frosty relations with its neighbours, and relying first on business and investment deals to drive the process.
With Syria, this brought impressive results. Trade over the past decade has risen from around $730mn to $2,270mn last year. Turkish exporters have done particularly well - exports to Syria have risen nearly tenfold. Cities close to the border like Gaziantep and Aleppo have enjoyed racing economic growth, thanks to this trade and an influx of Syrian and Turkish visitors taking advantage of visa-free travel.
The new relationship also brought officials closer together, and gave Turkey unusual access to the secretive Syrian ruling elite. Mr Erdogan developed a warm personal rapport with Bashar al-Assad, and there were regular meetings between the intelligence chiefs of the two countries.
So when anti-government protests started in Syria, Turkey was caught off-guard. Mr Erdogan had been quick to urge President Mubarak in Egypt to listen to the voice of the people, and step down. In Libya, constrained at first by Turkey's big investments and the presence of 25,000 Turkish nationals, Mr Erdogan kept up a dialogue with the Gaddafi regime for a while, but then joined the international coalition pressing him to leave.
But Syria was different. Foreign Minister Ahmet Davutoglu told me at the end of March that Turkey feared the chaos that might well follow the fall of President Assad. This is not like Egypt or Libya, he said. It has the potential to become an intractable sectarian conflict, more like Iraq. And Turkey shares a 900km border with Syria.
Those fears are shared by Turkey's Western partners, and there has been little criticism of Mr Erdogan's insistence that he should keep talking to President Assad, and urging him to embrace reform. No other leader has had so many, often lengthy, phone conversations with the Syrian president, and with no obvious alternatives to Mr Assad, there seemed little to lose by it.
But Turkey is also quietly exploring those alternatives. It allowed a meeting of hundreds of Syrian dissidents in the resort city of Antalya, with the aim of turning the disparate opposition forces into a more coherent movement.
Now the Turkish rhetoric towards President Assad has hardened, after more than 4,000 Syrian residents have come over the border into Hatay province, fleeing attacks by the security forces. There is widespread public sympathy here for the victims of the Syrian crackdown, accentuated by graphic images being circulated by activists.
Mr Erdogan is especially sensitive to public sentiments in what is an election week. He has condemned what he called "atrocities" by the Syrian authorities, and described the abuses as "unacceptable". He has hinted that he might endorse action by the UN Security Council, although Mr Davutoglu still argues that the time is not right to consider international intervention.
Turkey says it will allow anyone fleeing violence in Syria to cross its border, but it refuses to call them refugees, and the Turkish army is stopping journalists from meeting or interviewing the fugitives. The Turkish authorities say they are preparing for a much bigger influx.
Even Mr Erdogan's critics acknowledge that the government has little influence over events in Syria, and no good policy options.
Of particular concern is the possibility of unrest in the Kurdish areas of Syria spilling over, and igniting trouble among Turkey's restive Kurdish minority. President Assad has offered Syrian Kurds autonomy, and he invited Kurdish leaders for a meeting in Damascus right after the opposition meeting in Antalya, a pointed reminder to the Turkish government of the trouble Syria could cause if relations between the two countries break down.
Thirteen years ago they came close to war over the Syrian backing then for the Kurdish insurgent movement, the PKK. It was the withdrawal of that backing that allowed the Turkish armed forces to isolate the PKK, and capture its leader Abdullah Ocalan. Tension in the Kurdish region of Turkey is higher than it has been for many years, with the Turkish government sticking to its hard-line rejection of any dialogue with the PKK.
Losing Syrian co-operation over the Kurds is a significant price Turkey may have to pay for the fast-changing political environment in the Middle East, along with the potential loss of its recently-won commercial gains.