A court in Denmark has ordered the government to compensate 18 civilians who were tortured during the Iraq war in an operation carried out by Iraqi security forces along with a Danish battalion.

In total, 23 plaintiffs had sued Denmark after they were arrested and subjected to “torture and inhumane treatment” in 2004 during operation ‘Green Desert’ near Iraq’s main port city of Basra.

The appeals court in Denmark’s capital, Copenhagen, ruled on Friday that although the Danish soldiers did not join in the torture, they failed to prevent the abuse.

“The soldiers of the Danish battalion who were sent to Iraq in 2004 and partook in the operation were not found guilty of violence against the Iraqis,” the court said.

However, they were aware that the prisoners faced a “real risk” of being physically abused by the Iraqi security forces, judges said.

There was no evidence that the Danish battalion could have predicted the “systemic torture and violence” that took place, the court added.

Eighteen plaintiffs were awarded 30,000 danish kroner (roughly $4,600).

Defence Minister Claus Hjort Frederiksen said he was “satisfied” by the ruling exonerating the soldiers from torture, but added he would appeal the verdict because it placed Denmark “in a difficult situation”.

“This means that we can no longer contribute to improving security – and therefore guaranteeing human rights – in countries engaged in armed conflict,” he said in a statement.

Denmark has faced controversy over its role in Iraq on numerous occasions.

In 2015, Denmark’s Military Prosecution Service announced they would investigate Danish troops’ handling of Iraqi war prisoners after Politiken newspaper reported that their actions may have violated the Geneva Convention, Danish media reported at the time.

A document obtained by Politiken through a freedom of information request revealed that the Danish military handed over at least 12 Iraqi prisoners of war to local authorities despite receiving orders not to do so in 2004, fearing that they would be sentenced to death by the new Iraqi government.

Also in 2015, according to local media, newspaper Jyllands-Posten published a document that it said proved that former Danish Defence Minister Soren Gade tried to hide the Danish military’s agreement with security company Blackwater whose contractors killed 17 Iraqi civilians and wounded 20 in Baghdad’s Nisour Square in 2007.

The same year the Military Prosecution Service reportedly placed a group of five Danish soldiers under investigation after they were accused of taking “trophy photos” of dead Iraqis.

Denmark was a member of the coalition of occupying countries including the US and UK which invaded Iraq in 2003.

According to The Local Denmark, the small Scandinavian country still has around 180 troops at the al-Asad airbase near Baghdad where they have been training Iraqi and Kurdish forces.

Last month Denmark announced that it would withdraw around 60 special forces by late autumn since most areas in Iraq once controlled by the Islamic state of Iraq and the Levant (ISIL, also known as ISIS) have been liberated.