This is an account of the Turkish president's actions that night – that arguably may have led to the coup's failure.
The nation's first directly elected President Recep Tayyip Erdogan was also the most wanted person of that night.
The men behind the coup wanted to seize power by unseating the President and his administration. Coup backers stormed his hotel while others harassed his jet. That indicated that they would either have brought Erdogan to his knees or assassinated him.
"What is meant to happen will happen. We were already wearing our shrouds," Erdogan told those around him that night.
What would have happened in Turkey had they succeeded – if Erdogan had been taken or killed? Would the coup have been subverted?
We leave the answers to you.
Where was Erdogan that night?
Erdogan was on vacation with his family in Turkey's southern seaside resort of Marmaris in Mugla province.
Also in attendance on the trip was Berat Albayrak, Turkey's Minister of Energy and Natural Resources. Albayrak's wife is also Erdogan's daughter, Esra Albayrak.
The family were staying in a private residence located within the Turban Hotel's complex.
The house had been used in the past by an old friend of Erdogan's, the politician and businessman Ibrahim Yazici before he died in 2013. His son, Serkan Yazici now owns the property.
Was his location known?
Serkan Yazici said Erdogan's whereabouts was kept private on arrival and for the next five days prior to the coup.
Erdogan had decided to go Marmaris via helicopter without a presidential seal. He wanted a holiday away from the public eye.
Rumors spread soon after his arrival that the President was in Marmaris – but few were clear as to where. The Turkish newspaper Sozcu published a report about Erdogan's location. Until then, none knew he was in the city.
When and how did he learn about the coup attempt?
Around 9:30 pm, Erdogan received a phone call from his brother-in-law, Ziya Ilgen. Erdogan says he was entirely uninformed about the developments until that call.
"Something is going on in Beylerbeyi. There are rumors that soldiers are patrolling the Bosphorus Bridge and doing identity checks," Ilgen told Erdogan. After that phone conversation, Erdogan called MIT, Turkey's National Intelligence Organisation chief Hakan Fidan, as well as the head of the armed forces, General Hulusi Akar.
But neither of them was reachable.
He understood that something untoward was underway, but he could not make out the extent of the situation.
The governing AK Party's Secretary General Abdulhamit Gul then called Albayrak and Erdogan learned that military jets were flying low over Ankara.
Around 10:00 pm, Erdogan reached Fidan.
"I could reach Mr Fidan around 10:00 pm. He gave me a rough information about the situation," Erdogan told A Haber network.
What kind of security measures were taken?
After he learned something was afoot, he called his Chief of Cabinet Hasan Dogan and the director of Erdogan's guard unit, Muhsin Kose.
The two were accompanying Erdogan during his vacation.
All presidential guards were given tasks.
The primary plan was to evacuate Erdogan from that house. But the team also made a plan to set up a shelter in the basement in case.
How did Erdogan react?
Erdogan was very calm, according to Yazici.
"I went to the house to ask Erdogan and his family if they need anything. He was sitting in his suit," Yazici said.
"He kept making phone conversations. He looked very calm."
Albayrak, during an interview, also said it wasn't only Erdogan, but also the whole entourage who were at ease and calm.
"We did not have any fear or concerns," Albayrak said.
What happened then?
Around 11:00 pm, Prime Minister Binali Yildirim became the first Turkish official to announce that there was a coup attempt by a faction of the military.
AK Party's Mugla Deputy Nihat Ozturk told TRT World that the party's headquarters in major cities had called for people to gather on the streets to stand against the coup.
"When I arrived at the hotel, Mr President asked me to call people in front of the hotel and take positions. We called people on Facebook, WhatsApp and on some other social media outlets," Ozturk said.
While local people were gathering near to the hotel, a helicopter was waiting for the president on the runway located in front of the building.
Why did Erdogan appear on TV via FaceTime?
The president had managed to hold a first, very brief press conference from his hotel around 12.04 am.
It was recorded by state news agency Anadolu Agency staff and some local reporters deployed in Mugla. But it did not get enough coverage. The quality of the video was too poor and there were other technical problems.
CNN Turk Journalist Hande Firat got in touch with Dogan, and asked him if she could get the president on television, live through FaceTime.
"Let us gather at our squares and airports – and let them come with their tanks and cannons. Let them do what they will. I have yet to see any power greater than that of the people," he told Firat.
Some people had already hit the roads to counter the coup. However, most of the public went out after the FaceTime call.
What happened in the air on the way to Istanbul?
Erdogan's pilots switched their radio transponder to match that of a Turkish Airlines passenger plane, so that their aircraft could blend in with civilian traffic.
He was with his family in the plane.
His plane was then harassed by putschists' jets, though these in turn were shadowed by friendly fighters ready to blow the rebels out of the sky.
What happened in Marmaris after he left?
Around 3:20 am, a commando unit consisting of 38 putschists attacked Erdogan's hotel.
By then, the president was on the plane, flying from Dalaman to Istanbul.
They stormed the building, killing two policemen from the president's rearguard and wounding 25 others.
Thirty-seven of the Marmaris attackers were arrested in the following days.
How did Erdogan land in Istanbul? What happened after his landing?
Erdogan arrived at Ataturk Airport Istanbul around 3:30 am.
The airport had been occupied by putschist troops and tanks. So Erdogan's jet circled south of Istanbul for a length of time in a holding pattern.
By the time he landed, the airport had been flooded with members of the public who proceeded to give the president a riotous welcome.
The night wasn't over though, as clashes between people and coup perpetrators continued on for hours. The coup failed on July 16 in the late hours in the morning.
Author: Zeynep Sahin