ZURICH (Reuters) - Switzerland’s parliament approved allowing convicted militants to be sent home to countries where they could face torture, leaving the government to decide how to implement the motion without breaking international law.

The Swiss constitution bans expelling people to countries where they might be subject to torture. But parliament’s upper house on Tuesday narrowly adopted a motion allowing exceptions for foreign militants, as the Swiss lower house had done.

The motion stems from discontent among lawmakers over the ability of Iraqi jihadists convicted in Swiss courts of aiding Islamic State (IS) to avoid being sent home because of the ban on exposing people to torture or other inhumane treatment.

Conservative critics say the ban has cost taxpayer money to care for convicted militants and angered citizens who say Switzerland should not have to host such people on its soil.

Justice Minister Karin Keller-Sutter told a debate in parliament that the government sympathized with proponents of the measure but its hands were tied.

“The security of the Swiss population has top priority but we also have to adhere to the limits of the rule of law.”

One of the convicted militants is a wheelchair-bound man found guilty in 2016 of planning terrorist attacks and helping IS operatives enter Switzerland. Freed from prison, he now lives in a transit center for asylum seekers and is fighting extradition.

Switzerland said this month it would not help bring home its own stranded citizens who had joined jihadist forces in Syria and Iraq, insisting national security was paramount.

Switzerland is a signatory to the United Nations’ 1984 Convention against Torture, which bars expulsions of people to another state where there are substantial grounds for believing they would be in danger of being subjected to torture.

Iraq is also a party to the convention, but lacks laws or guidelines providing for judicial action when defendants allege torture or mistreatment, Human Rights Watch said in a report last year. It said torture was rampant in Iraq’s justice system.