Poland defied the European Union’s unprecedented call for members to punish it for failing to uphold the bloc’s values, signing into law a judicial overhaul that puts the country at risk of economic sanctions and losing its voting rights.

President Andrzej Duda announced the decision on Wednesday, hours after the European Commission said the government in Warsaw posed a threat to the rule of law by putting courts under political control and recommended triggering Article 7 of the EU treaty.

The process is unlikely to lead to Poland being shut out of decision making. But, backed by German Chancellor Angela Merkel and French President Emmanuel Macron, it underscores the erosion of trust between the bloc’s largest states and some of its eastern members.

After years of juggling crises including Greece’s debt saga and the worst migration emergency since World War II, EU leaders are turning their attention to the rise of populist forces that reject the bloc’s values. The decision is a shot across the bow for governments such as Hungary’s, where Prime Minister Viktor Orban has called for rolling back the liberal framework underpinning the world’s largest trading club.

“Within a period of two years, a significant number of laws have been adopted, which put at serious risk independence of the judiciary and the separation of powers in Poland,” said Frans Timmermans, principal vice president of the commission. “The commission can now only conclude that there is a clear risk of a serious breach of the rule of law by Poland.”

The disciplinary decision, while damaging to Poland’s reputation, was expected by investors after Prime Minister Mateusz Morawiecki said his country was not going to budge.

While the EU left the door open for Poland to resolve the conflict, giving it three months to address recommendations, Duda’s signing of the laws only increases the risk of deeper acrimony between the two sides.

The legislation, an early version of which was vetoed by the president amid nationwide protests, will force two-fifths of Supreme Court Justices to retire and give politicians sway over court appointments. Duda said the laws would make Poland “more democratic” and that judges couldn’t be a “privileged, self-serving caste.”

“I’m listening to the voices of criticism about politicizing the judiciary elite with a bitter aftertaste,” Duda said after signing the laws following the commission’s recommendation. “I don’t see a problem with parliament having more influence over who becomes a judge.”

While actually imposing sanctions needs unanimous support from the leaders of the EU’s other 27 countries, that’s unlikely, because Hungary has vowed to shield Poland. Hungarian Deputy Prime Minister Zsolt Semjen said it’s unacceptable for Brussels to punish democratic governments.

“Both the Hungarian-Polish friendship and the Hungarian government’s commitment to treaties bind us to oppose the commission’s move,” said Semjen, according to the state-run MTI news service.

Poland is the biggest recipient of EU aid which, at roughly $11.8 billion a year, has driven growth in the country of 38 million since it joined the EU in 2004.