The Turkish prime minister's campaign to purge the top echelons of the national police and tame the country's senior judges ran into its first wall of international criticism on Tuesday when Brussels told Recep Tayipp Erdoğan that he had to rewrite a contested bill to follow European standards.

Erdoğan is on his first visit to Brussels in five years, just weeks after the biggest corruption scandal in years erupted in Turkey. He was told that his bill giving the executive authority over judges and prosecutors ran foul of European constitutional norms on the separation of powers.

The prime minister stood his ground, insisting that he was committed to the separation of powers . But he argued that judges were not acting independently in Turkey and that his bill would force them to do so.

"The judiciary should not go beyond its defined mission and mandate," said Erdoğan. "When one power starts interfering with another power, this country loses its quality of democracy."

The problem, he said, would be fixed "legislatively". His remedy includes putting the justice minister – a new appointment and close ally – in a position to discipline and remove judges and prosecutors.

Erdoğan's robust defence of his controversial policies follows the allegations of corruption on a huge scale at the heart of his government, also implicating the prime minister's family.

Dismissing the investigation into the sleaze allegations as a foreign plot to topple his government, he has moved to purge senior police ranks and exert greater control over the judiciary. According to the European commission (EC), some 2,000 senior police officers, including most of those in key intelligence and investigative roles, have been fired or re-assigned in the past month.

José Manuel Barroso, EC president, said after talks with Erdoğan: "Whatever the problems are, the solutions should respect the principles of the rule of law and the separation of powers."

Erdoğan's war with Turkey's judges and police is ascribed to a bitter power struggle with his erstwhile ally, the US-based Islamic cleric Fethullah Gülen, who runs networks of religious schools and cultural bodies in Turkey and who is said to have high-powered followers within the state's security and judicial structures.

"That's the core of the problem," said a senior EU official dealing with Turkey. "It's a big setback. There has been damage done to the rule of law in Turkey. We made our concerns very clear."

Frank-Walter Steinmeier, Germany's foreign minister, warned on Monday that EU membership talks with Turkey might need to be frozen because of Erdoğan's conduct. The negotiations only resumed in November after being suspended for 40 months because of various other disputes.

Erdoğan, who dominates Turkish politics after 11 years in office, has turned increasingly authoritarian since last May, when his power was challenged as never before by a wave of national street protest that was crushed by excessive police violence.

The contested judiciary bill is currently being pushed through parliament in Ankara. The main opposition Republican People's party (CHP) and the Nationalist Movement party (MHP), which both oppose the changes proposed by the Erdoğan government, called for the bill to be put to the parliamentary constitutional commission. According to Turkish media reports, this met on Monday, with the justice minister, Bekir Bozdağ present, but failed to reach agreement.

The former culture minister, Ertugrul Günay, who resigned from Erdoğan's Justice and Development (AK) party over the government's handling of the corruption scandal, harshly criticised the government's proposed changes to the judiciary law as "unconstitutional".

He said: "I am sad to see what politics has come to. Important judicial changes are being made. We are trying to change a law that underwent reforms three years ago. Many believe this law is unconstitutional ... You might need the law one day. Let's not change the laws according to what might suit you and what might suit me."

President Abdullah Gül, who must sign the bill into law, has also voiced reservations about the proposed measures.

If Erdoğan pushes the bill through, there is likely to be an appeal to the constitutional or supreme court. But the law would be in force pending the appeal, enabling the government, critics say, to make the personnel changes it wants.