WARSAW (Reuters) - Polish lawmakers approved an overhaul of the judiciary on Friday, giving parliament de facto control over the selection of judges in defiance of the European Union.

The legislation, if agreed by the Senate and President Andrzej Duda, will heighten tensions with the EU which has threatened legal action over proposed reform that it says will subvert the rule of law.

The eurosceptic Law and Justice (PiS) party, which holds a majority in parliament, argues the judiciary needs to be changed to repair a corrupt system and make courts more efficient. The EU says giving politicians a say in appointing judges will threaten the impartiality of the courts.

Critics of the deeply conservative government see the proposed reforms as part of a broader shift toward authoritarianism by the deeply conservative government.

The EU is also at loggerheads with the PiS over migration policy, logging in an ancient forest in Poland and the government’s efforts to take control of other state institutions such as public media.

A panel of constitutional law experts of the Council of Europe human rights body said on Friday the proposed reforms imperiled all parts of the judiciary and would “lead to a far reaching politicization of this body”.

Under the legislation, heavily supported by PiS lawmakers, parliament would have a virtual free hand in choosing members of the National Judiciary Council (KRS), a powerful body that decides judicial appointments and promotions which was a right earlier reserved chiefly for the judges themselves.

A second bill, also approved, envisages lowering the mandatory retirement age for Supreme Court judges to 65 years from 70, which would force a significant part of them to leave.

“We are moving forward with reforms of the justice system, and the Supreme Court reform is an element of this process,” said Pawel Mucha, an adviser to Duda.

The KRS has repeatedly voiced its opposition to the plans.

Spokesman Waldemar Żurek said: “In my opinion, these changes will hurt the citizens because politicization of courts means that no citizen will be assured that a judge presiding over a case isn’t being influenced by politicians.”

Despite criticism abroad as well, the PiS government remains one of Poland’s most popular governments since the 1989 collapse of communism, because of low unemployment, generous public spending and its adherence to traditional Catholic values.

Friday’s votes came a day after the PiS sacked its prime minister, Beata Szydlo, and replaced her with Finance Minister Mateusz Morawiecki, a loyalist of Jaroslaw Kaczynski, the party leader and Poland’s paramount politician.

Morawiecki told Trwam television on Friday his priorities would be economic development, social cohesion, fighting tax evasion and an improvement of Poland’s reputation abroad.

Analysts said the changeover was spurred by Kaczynski’s desire to quell infighting within the cabinet and put more emphasis on economic policy as the party faces three consecutive years of elections.

A local ballot is held next year, a parliamentary vote in 2019 and a presidential election in 2020.