The President of the Republic of Turkey begins his day with a prayer. Usually, this is between five and six o'clock in the morning, depending on when the sun rises. He walks on a treadmill for half an hour, lifting weights at the same time.

He gets dressed.

Being a simple Turk, Recep Tayyip Erdoğan likes to wear coarse plaid suits. Recently he adds a waistcoat. He has a breakfast that is light because he suffers from diabetes. He reads memos sent by his advisers, followed by the morning newspapers. He prefers the papers which provide favourable coverage, like Sabah, which is owned by his friends.

At 8 o'clock, he receives his office manager and spokesman and they review the agenda for the day. He makes his way from his private villa to the palace at around 11 o'clock.

Erdoğan turned 64 in February. Despite having surgery to remove a tumour from his colon in 2011, his routine remains strenuous. Throughout his day, he receives visitors of all kinds: ministers, deputies, mayors, diplomats. Erdoğan controls every minutiae of government. Everywhere he goes, he carries a notebook, in which he scribbles constantly. He will not go home until midnight and expects his staff to stay in the office for at least as long. He rarely takes more than a day's vacation.

Government officials portray Erdoğan as a stern patriarch. His outbursts of anger, often accompanied by him throwing his iPad at one of his staff, are legendary. Grown men lower their voices in his presence. Their faces become solemn, almost stiff. They look down, obedient, nervous, mindful.

One European ambassador, a former diplomat in Turkey, describes the president’s personality as unpredictable.

“Erdoğan is often a very charming man,” the ambassador says. "He convinces you with his politeness and soft approach. He generates a positive feeling. Then later he inexplicably destroys any goodwill he built with his 'mad' moments, just irrational behaviour and accusations."

In his youth, Erdoğan played semi-professional football for local Istanbul municipality club, IETT Spor. To this day, he likes to surround himself with sports personalities. He brought a wrestler and a basketball player onto his advisory staff. Until two years ago, he regularly played basketball with his bodyguards and personnel.

Erdoğan does not read books, but he watches TV excessively. Running in his office and inside his modified Mercedes S600 is A-Haber (A-News), a channel known for conspiracy theories and attacks on Erdoğan’s critics. Since Erdoğan only speaks Turkish, there is no foreign media on any of the TVs. His Press and Information Office, however, translates the major stories for him, especially if he is mentioned. The president is obsessive about what the west thinks and says about him.

He is passionate about history, especially the Ottoman Empire. If he can help it, he never misses an episode of TV series ‘Payitaht: Abdülhamid,’ a sprawling 54-episode saga depicting the life of Sultan Abdülhamid II. Erdoğan admires Abdülhamid II, the last head of the Ottoman Empire to hold any real power, and a ruler known as the "bloody sultan" for his harsh leadership style.

For Erdoğan, the founding of the republic by Mustafa Kemal Atatürk in 1923 was a historic mistake. He would like Turkey to return to the times of Abdulhamid II, when the Ottoman Empire extended from the Middle East to the Balkans.

Outwardly Erdoğan appears as a strongman, a leader of the people. But those who have known him for a long time describe him as a complainer who slavishly aligns his policies with surveys and polls. These days the data his pollsters bring him are increasingly worrying to him.

In April, Erdoğan unilaterally called for national elections to take place on 24 June, 18 months earlier than planned. It was to be a predestined vote that would see him installed as the first executive president of Turkey.

His lead in the polls since the announcement has been shrinking, however. His government faces a currency crisis to which Erdoğan has no solution and the opposition seems determined to seize their last chance to halt his pursuit of total power.

The palace is now in an apocalyptic mood, say insiders. While nobody in Erdoğan's inner circle dares to talk openly to the president about the potential for defeat, some staff are preparing exit strategies. A high-ranking government politician confesses that he fears for his future if Erdoğan loses, but hopes his wife and children will get out of the country.

Erdoğan has turned Turkey into an autocracy since coming to power in 2003 under the banner of his Justice and Development Party, known as AKP. He has bent the judiciary to his will, decimated the military and declared war on the press.

Last spring, citizens narrowly voted in favour of the introduction of a presidential system, amid allegations of government electoral trickery. It granted near total and unchecked power to the head of state. Now Turkey faces a turning point: Should Erdoğan win the election on 24 June, which is likely, his autocracy will be cemented for years. If he loses, Turkey faces months of unpredictability. Nobody knows if Erdoğan would even accept defeat and the peaceful transfer of power.

Who is this man who has bound his own fate so closely with his country’s? How does he exercise his rule? Der Spiegel, with the help of The Black Sea, talked to more than two dozen confidants of the president in recent months: advisors, government officials, party colleagues, diplomats, ministers, and delved into the world of Erdoğan’s politics. Most of them insisted their names not be mentioned. They are afraid that Erdoğan might take revenge, as he is known to do.

Their reports, along with internal documents, paint a picture of a Turkish president we did not yet know: An Erdoğan at the zenith of his power, but obsessed with losing it. Feeling misunderstood, he trusts only his family, which has led to disquiet within the government. Erdoğan now reckons with his own survival, and faces an uncertain future in the event of a defeat.

For him, 24 June is more than an election.