ISTANBUL : A Turkish court ordered that eight police officers be kept in custody on Friday pending a possible trial over accusations that they spied on Prime Minister Tayyip Erdogan and his inner circle, media reports said.

The investigation is widely seen as targeting a “parallel structure” within the state, a term coined by Erdogan to describe members of the police, judiciary and other institutions loyal to US-based Islamic cleric Fethullah Gulen. Erdogan accuses Gulen of being behind a plot to oust him.

Many of those detained are among the police officers who carried out a corruption probe centered on Erdogan’s inner circle that became public last December. They say the latest investigation is politically motivated. State broadcaster TRT said the Istanbul court remanded eight officers in custody and released six others. Earlier prosecutors had ordered the release of eight other officers.

They have yet to rule on the remaining detainees.

Relatives of the officers gathered at the courts of justice in central Istanbul for the ruling, applauding the release of some officers and protesting the formal arrest of the others, which came less than three weeks ahead of a presidential election in which Erdogan is standing.

Police on Tuesday detained dozens of police, including high-ranking officers, on a list of 115 whom chief Istanbul prosecutor Hadi Salihoglu ordered to be questioned over what he said was a concocted investigation of an alleged terrorist group.

The operation follows a stream of purges targeting the police, judiciary and state institutions this year which government critics have condemned as a symptom of Erdogan’s tightening grip.

Concern about his autocratic style has been fuelled by his intention to boost the powers of the presidency if he is elected, a plan he reiterated late on Monday.

The officers were accused of making up an investigation into an alleged terrorist group named ‘selam-tevhid’ as a pretence to tap the phones of Erdogan, ministers and the head of the national intelligence agency.

The ‘selam-tevhid’ case, targeting 251 people, had been dismissed due to a lack of evidence after a three-year investigation during which 2,280 people were wire-tapped.

Erdogan has signalled that the investigation of the “parallel structure” will widen. He accuses Gulen’s Hizmet network of concocting the scandal by illegally tapping thousands of phones and leaking manipulated recordings on social media.

Gulen, who has lived in self-imposed exile in Pennsylvania since 1999, denies plotting against the government.