A week out from Turkey's election and President Recep Tayyip Erdogan appears to doing everything he can to lose. But appearances can be deceptive.

There have been three horrific terrorist attacks by ISIS in Turkey since June, killing around 150 mostly young and Kurdish Turks. It is widely believed the most recent — and most deadly — attack on 10 October could have been prevented. Given some of the perpetrators were well known for extremist Islamic views, it's hard to credit Turkish security services were not aware of the danger.

It is equally difficult to believe the hands-on and controlling Erdogan would have been unaware of any 'deep state' activity that could explain why the security forces sat back and let the deadly incident take place. Surely the failure of the man and his party, the AKP, to protect the country's citizens from such carnage should guarantee an election loss?

The repeat nature of the election should also be a formidable obstacle to victory. Turkey is heading to the polls for the second time in five months after Erdogan failed to win a majority. According to the constitution, the lack of a clear winner meant AKP should have worked with other parties to build a coalition; an obligation Erdogan has simply ignored. One would think this obstinate refusal to acknowledge the will of the people would lead to even fewer votes this time around.

Or will the wily Erdogan's calculations prove superior to such reasoning? Since the June election result, he appears to have been pursuing a two-pronged strategy to retain power. First, it seems he is convinced terrorism of any kind will turn a fearful population toward him as they seek out a strongman who can protect his country, as long as he has a mandate to operate and particularly if he can disregard democratic checks and balances.

Secondly, Erdogan is extracting a strategic advantage from the wave of refugees streaming across Europe by using Turkey's position as the main refugee entry point to maximum advantage in his dealings with the EU. He knows the EU needs Turkey if it is to have any hope of regulating the refugee flow, and he is playing this card for all its worth. He first ratcheted up the EU's financial assistance from a one-off payment of €0.5 billion to €3 billion, and the EU is now considering annual payments. In addition, Turkey has won easier access to Europe for its people and renewed negotiations towards EU membership. Erdogan is clearly bent on showing his countrymen that in these negotiations it is Ankara, not Brussels, calling the shots.

The 1 November election will show whether such brinkmanship will succeed. If the AKP gets an absolute majority, Erdogan's hold on power will continue into the foreseeable future. If not, difficult coalition negotiations lie ahead. In either case, Erdogan's actions will cast a long shadow over Turkey's future. This election could well be the fork in the road when Erdogan chooses whether he wants to go down in history as an authoritarian, yet ultimately democratic, statesman, or as a despot wedded to absolute power and conservative Sunni ideology.

If he chooses the latter, Turkey will lose out. It would not become an EU member. It would eventually be forced to leave NATO. Worse, the country would forgo the core of its Kemalist heritage and its hard-won ability to reconcile Islamic tradition with enlightened modernism. And that could well start a slide into civil war.

Photo by Aykut Unlupinar/Anadolu Agency/Getty Images