Türker Yilmaz* was not long into his police academy training when he realised how the system worked. The good jobs, the better pay, the promotion prospects all depended on your dedication to a shadowy Islamic network with its headquarters based in Pennsylvania.

"They kept tabs on every recruit, had a grading system from zero to five – five being the ones who prayed, fasted, never drank alcohol," the policeman said, referring to the movement founded by the Muslim cleric Fethullah Gülen, who lives in exile in the US.

"Everything starts in the police schools," said Yilmaz. "They came to me once, I said no. But it's very subtle. One day a friend will ask you to go to breakfast at a certain friend's house, to read a certain book, go for dinner. These appointments become more and more regular. When you're in school, you have very little money. They organise a few things to make it easier. Free meals, for example, free accommodation. Once you're inside, they organise your life; you just get sucked in. And once you graduate, you can start working in whichever unit you like."

The power and the influence of the elderly cleric is the defining issue of Turkish politics. Recep Tayyıp Erdoğan, the prime minister, has declared war on Gülen – previously a key ally of his conservative, Islamic ruling party – following the eruption of a corruption scandal in December that implicates the government, the prime minister's closest associates and his family.

Erdoğan responded ferociously, purging the police of thousands of officers, transferring prosecutors linked to the investigation and tightening control over the judiciary. A fortnight ago, according to senior officials in Brussels, he told EU leaders that his fight with Gülen was a matter of political survival. "He was gripped with this obsession of killing the parallel state, as he called it," said a well-placed EU official.

In Turkey it has long been assumed that Gülen's network exercised unaccountable influence inside the judicial and security apparatus. The investigative journalist Ahmet Şık was jailed for writing a book about it, as was Hanefi Avcı, a former police chief. But that was when Erdoğan and Gülen were allies.

Assertion

In 2009 the then US ambassador in Ankara, James Jeffrey, wrote in a cable to the state department: "The assertion that the Turkish national police is controlled by Gülenists is impossible to confirm but we have found no one who disputes it."

Yilmaz and other police officers who spoke up confirmed the scale and degree of penetration by adherents of a movement that is religious, cultural and educational as well as political.

Oğuz Gün* has been working in the Istanbul police force for more than seven years. "Such opaque groups are very dangerous. And [Gülen's] is a group that discriminates against those who don't share the same values and the same lifestyle. I have seen how they started to mistake sins for crimes, both inside and outside the force," he said.

He sought transfers to other units: secret intelligence, anti-terror, organised crime. To no avail. Gün was never affiliated with the Gülenist movement. "Sometimes they openly asked for a reference. Without it, I didn't stand a chance."

Yilmaz said: "If you asked someone how did you manage to get into the secret intelligence unit, they would answer: I prayed and got in. We had friends who spoke six languages, were top of their class, and were standing guard outside police stations. And others who were a lot less qualified got the top jobs only because they were connected with the Gülenists."

The assumption in Turkey and abroad is that the corruption allegations against the Erdoğan administration originate with Gülen, and that they are likely to be well-founded because of the quality of the intelligence the movement commands. Erdoğan is seen to be trying not only to destroy the cleric but also to bury the corruption allegations.

Şık, the journalist jailed in 2011 for writing a book on Gülen's penetration of the police, highlighted what many see as the problem. "The attempt to purge Gülenists doesn't mean that [Erdoğan] is right. There is also a real witchhunt going on. We have massive corruption on the one hand, but the investigation against it also violates democratic and judicial principles. It's a choice between a rock and a hard place, pest and cholera. One is not better, or cleaner, than the other."

The officers welcomed the backlash against the network inside the police but stressed that it should not serve to legitimise corruption. "Of course I want those who are corrupt to be punished. I am not defending corruption at all. But these purges were long overdue," said Yilmaz. "The government knew about this. It was the government in the first place who enabled them, who helped them, they came to power together. Helping them was the government's biggest mistake."

Gün spoke of a huge sense of relief among his colleagues that the police were being cleared of the network. "It really was an atmosphere of deep paranoia. Even if it seemed technically impossible for every single officer's phone to be tapped, we were all afraid of being spied on all the time."

The pressure was subtle, but constant: "Nobody would force you to pray, or fast during Ramadan. But they kept tabs on all of that, on everyone. Nobody talked about it. Everybody knew, but nobody dared to discuss the issue. This has started to change."

Erdoğan's offensive represents a sea change. The domination of his Justice and Development party (AKP) for more than a decade was aided by his alliance with Gülen, the cleric's formidable organisation, money and influence.

Those who dared to criticise the Gülen movement before were swiftly punished. Şık was accused of being a member of a nationalist network, although he and his colleagues had previously disclosed plans by the same network to stage a military coup against the AKP government. He was released from jail in 2012, but his trial is ongoing.

Phone-tapping

In 2010 Hanefi Avcı, a former police chief and former Gülen supporter, was arrested on charges of being a member of a terrorist organisation after publishing a book in which he described the infiltration of the Turkish police force by the Gülenists and accused them of illegally tapping phones and falsifying evidence. Last year the self-described rightwing sympathiser was sentenced to more than 15 years in jail for membership of the armed leftwing group Revolutionary Headquarters.

Erdoğan's current purges are dramatic and far-reaching. But the officers say such purges have been taking place more quietly for years. According to both Yilmaz and Gün, internal investigations have been conducted against tens of thousands of police officers over the past four years alone. "If someone was suspected of going against [Gülen] they were often hit with made-up disciplinary charges, transferred to bad posts, or even suspended," Gün said. "The removals we see today are not new. They just hit the other camp."

Not all police officers, however, are as happy with the current purges. The Police Reform Group, an organisation campaigning for police rights, tweeted: "How do you know that the officers who were transferred are Gülenists and members of an organisation? Do you have a detector? Where is justice?"

EU officials monitoring the drama say Erdoğan is deploying an indiscriminate dragnet in the belief that it will catch all the Gülen appointments. Yilmaz agrees. "I am guessing that not all of these guys were Gülenists. And not all sympathisers were bad, either. And no police officer should ever be punished just for doing a good job."

Faruk Sezer, a founding member of the unofficial police union Emniyet-Sen, argued that a transparent inquiry into the alleged shadow organisation was indispensable. "If an officer committed a crime, it needs to be brought to light and that person needs to be suspended and punished. But those who were transferred without reason and proof should of course be reinstated."

Last month Istanbul prosecutors started an investigation into officers who took part in anti-corruption raids in December. Do police officers fear doing their job in such a loaded atmosphere? Yilmaz shrugged: "We have started to tell jokes among ourselves like: oh dear, you caught a shoplifter, you'd better start packing your bags, you'll get transferred for that."

"The war between Gülen and the government will not end any time soon," said Şık. "Turkish people caught in the middle will suffer. We already live in a very oppressive period, and I am afraid that this might get much worse."

* Names have been changed.