The European Union's top court ruled on Tuesday that Poland violated environmental laws with its massive felling of trees in one of Europe's last pristine forests.

The ruling by the European Court of Justice said that, in increasing logging in the Bialowieza Forest in 2016-17, Poland failed to fulfil its obligations under EU directives to protect natural sites of special importance.

Poland's environment minister at the time, Jan Szyszko, argued that felling the trees was necessary to fight the spread of bark beetle infestation. Heavy machines were used in the process, causing additional damage to the forest.

Poland's conservative government is involved in a number of disputes with the EU, including one over changes to the judicial system - an argument that has led Brussels to trigger a process that could lead to punitive measures against Warsaw.

In the forest dispute, the court said bark beetle infestation did not justify the scale of the logging, while Poland failed to ensure the safety of birds and other species in the forest. No fines were imposed because the machines have been removed and the excessive logging has stopped.

Environmentalists say the large-scale felling of trees in Bialowieza, which straddles Poland's eastern border with Belarus, destroyed rare animal habitats and plants in violation of EU regulations. They held protests at the site and brought the case before the EU court.