Turkish authorities were planning a major shake-up of the military to remove elements linked to US-based preacher Fethullah Gulen just ahead of the failed coup, a key minister said Wednesday.
Energy Minister Berat Albayrak, who is the son-in-law of President Recep Tayyip Erdogan, suggested parts of the military had wanted to act against the government as they knew they were about to be purged.
Albayrak, who was with Erdogan throughout the night of the botched putsch on July 15, said the president had first been warned about the coup by a civilian and it was only later that the gravity of the situation became clear.
In his first meeting with foreign reporters since the coup night, Albayrak revealed that Turkey's Supreme Military Council (YAS) had this summer been planning to meet to expel all officers linked to Gulen, who Turkey blames for masterminding the putsch.
"They were going to take really important steps to remove Gulenist officers and generals from the armed forces. We were already working on this."
He said this would have been part of a general purge against pro-Gulen elements that would have also extended to the legal system and other institutions.
"These people (linked to Gulen) were detected and the related lists had been conveyed to the line ministries."
He added: "After they (the plotters) realised things were going like this, at their last breath, they took their final step (the coup)."
He said only a small proportion of the NATO member's 750,000-strong military supported the coup but alleged pro-Gulen figures had successfully infiltrated the high and middle ranks in large numbers.
"If we are speaking especially at the level of general we understand the level of the problem."
Albayrak, who is married to Erdogan's eldest daughter Esra, was with the president at the holiday resort of Marmaris in southwestern Turkey when they received news of the coup.
"We received the first phone call from a civilian from the Istanbul area -- you cannot rationalise something based on one phone call," he said.
It was only after Erdogan could not reach important figures like chief of staff Hulusi Akar -- who had been abducted -- that the gravity of the situation became clear.
"We had phone calls with ministers and we realised this was not a simple thing but a coordinated coup d'etat," Albayrak said.
He said the president then spoke to Turkish media from his hotel but because some media -- such as state-run TRT -- had been taken over by the plotters the remarks were not broadcast.
"So Turkey did not hear us," he said.
It was at this point that, through FaceTime and using channels that had not been taken over, Erdogan made his now famous call to citizens to defeat the coup, Albayrak explained.
"This was one of the most important turning points," he said, recalling how crowds of Erdogan supporters then poured onto the streets to defeat the rebels.
The president then decided to fly back to Istanbul from the nearby airport of Dalaman to direct measures to stop the coup.
"Until the last minute it was not clear which place we were going to choose" to fly back from, Albayrak said.