Turkey’s energy minister says Turkish authorities were planning a major shake-up of the military to purge elements linked to US-based opposition figure, Fethullah Gulen, just before the coup attempt that left hundreds of people dead.

Berat Albayrak, who is also the son-in-law of President Recep Tayyip Erdogan, hinted that parts of the military had been seeking to act against the government as they knew they would be removed from their positions.

Albayrak revealed that Turkey's Supreme Military Council (YAS), the highest body responsible for appointments in the armed forces, had been planning this summer to convene to expel all officers linked to Gulen.

"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, adding that the purge would have also extended to the legal system and other institutions.

He also alleged that pro-Gulen figures had successfully infiltrated the high and middle ranks of the military in large numbers.

Albayrak said Erdogan had first been warned about the coup by a civilian from the Istanbul area, adding that Ankara could not “rationalize something based on one phone call."

He said that the gravity of the situation became clear when the Turkish president could not reach important figures.

Demonstrators, seen through a hole in a hotel window near Istanbul's Taksim Square, wave Turkish flags on July 24, 2016 during a rally to condemn the coup attempt against President Recep Tayyip Erdogan. ©AFP

About 250 people were killed and more than 2,000 injured on the night of July 15, when a faction within the army, using fighter jets, helicopters and tanks, tried to seize airports and bridges, and attacked buildings, including parliament and the intelligence headquarters, in an attempt to seize power.

Following the abortive coup, Ankara declared a state of emergency in the country, which would allow the government to take swift action against those suspected of being behind the coup attempt.

Turkish troops detain Staff Sergeant Erkan Cikat, one of the missing military personnel suspected of being involved in the coup attempt, in Marmaris, Turkey, July 25, 2016. ©Reuters

Erdogan accuses Gulen of masterminding the coup against him. The cleric denies the accusation.

On July 26, the Turkish parliament set up a commission to investigate the coup attempt, with the backing of all political parties.

The Turkish government has vowed to severely punish coup plotters, sparking concerns about human rights breaches.

Amnesty International said earlier that it has “credible evidence” that around 10,000 Turkish soldiers face severe punishments for their part of the failed military coup against Erdogan.