When Mustapha Merzoughi, a French citizen of Tunisian origin, left France for Syria in 2015, he hoped to start afresh in the so-called Islamic State and leave behind a life plagued with what he called social and financial problems.

But as he faced a judge in Iraq’s capital Baghdad last week, he wished nothing more than to return to France.

“All I want is to go back home,” he implored the court with a shaky voice. “If there’s anyone from the French embassy here, I’m asking you to take care of my case and bring me back to France.”

Merzoughi was captured by the US-backed Syrian opposition forces during the final push to defeat Isis in eastern Syria. After France refused to take him back, he and 11 other Isis suspects of French origin were handed over to Iraqi authorities and charged under Iraq’s sweeping counter-terrorism laws.

Wearing yellow jumpsuits and plastic slippers, eight of the Frenchmen appeared in a Baghdad court last week. In the presence of journalists, French diplomats and UN observers, they listened to the accusations levied against them: joining Isis and taking part in military operations. Videos set to dramatic music charted out their journey to Syria and their role in the terror group.

“I made a mistake. I joined a terror organisation,” Merzoughi admitted. “But I didn’t kill anyone.”

A court-appointed lawyer who had only met his client a few minutes before the trial drafted an impromptu defence. In the end, Merzoughi and six others were sentenced to death.

On Sunday the same court sentenced two more French citizens to death: Fadhil Aouidate, 33, and Vianney Jamal Abdelqader, 29.

The sentences are subject to appeal, a process that could take years.

Iraq’s authorities are holding hundreds of foreign Isis members captured on its soil. But the transfers of the twelve Frenchmen could set a precedent for about 2,000 foreign fighters lingering in camps in eastern Syria with no clear path to repatriation or justice. Iraq has previously expressed its willingness to try them, reportedly in return for monetary compensation.

The trials highlight the moral predicament of allowing extradition of European citizens to a country that ranks among the world’s top executioners.

Human rights groups have criticised Iraq’s courts for handing down death penalties based on confessions rather than material evidence, a worrying practice in a country where force is frequently used during investigations.

Human Rights Watch has condemned what it calls France’s “outsourcing” of Isis suspects’ trials to Iraq.

“France and other countries should not be outsourcing management of their terrorism suspects to abusive justice systems,” said HRW’s acting Middle East director, Lama Fakih, on Friday.

“These countries should not be sitting idly by while their citizens are transferred to a country where their right to a fair trial and protection from torture are undermined.”

One of the French suspects who was sentenced to death on Sunday, Fadhil Aouidate, has claimed that he incurred a beating and fractured rib during his interrogation. He lifted his shirt to reveal marks on his upper body. The judge adjourned the case to allow for an examination by a forensic medic, who later ruled that his allegations of torture were unsubstaniated.

“Because of the nature of the trials in Iraq – which we’ve seen do not provide fair trials to Isis suspects and where detainees being transferred are at real risk of torture – no group can under international law be transferring detainees into that context,” said Belkis Wille, senior Iraq researcher for Human Rights Watch.

The French foreign ministry said on Monday that it opposed the death penalty but it also reiterated its respect for the sovereignty of Iraq’s institutions, implying it would not intervene in judicial proceedings. An official familiar with the French position told the Guardian: “There’s a consensus that the best option is to have them tried in Iraq.”

Mustapha Merzoughi was sentenced to death by the Iraqi court. Photograph: AFP/Getty Images

Most of the French suspects on trial this week denied ever having set foot inside Iraq, but Iraqi officials claim that the terror group’s full name (the Islamic State of Iraq and Syria) and the devastating impact on Iraq are sufficient basis for jurisdiction, regardless of whether the accused individuals committed crimes on Iraqi soil.

In France, joining a terror organisation is punishable by up to 20 years in prison for those in leadership positions, in addition to a fine. But obtaining evidence on whether suspects committed violent crimes is difficult, which means they could walk free or get away with a lenient sentence, a politically explosive matter and security hazard European governments appear determined to avoid.

Baghdad’s court referred to intelligence reports detailing the Frenchmen’s activities, but didn’t present them during the public hearings.

The suspects, in turn, tried to paint a benign picture of their role in the so-called caliphate. They denied ever having pledged allegiance to Isis, describing their mounting disillusionment with injustice, chaos, and empty promises.

Although they admitted to having worked for Isis as medics, trainers, stars in propaganda videos and members of the religious police, they said they did so under threat of imprisonment. Like Merzoughi, most denied taking part in military operations.

“You confessed to the investigative judge that you participated in military operations against Iraqi security force in Mosul and Anbar,” Iraqi court judge Ahmed Al Hurdaithytold Merzoughi during the questioning.

“No it’s not true,” Merzoughi answered, speaking through an interpreter provided by the French embassy.

“You said all of this in front of the investigative judge, a lawyer and a prosecutor, you signed the report and you even finger-printed it.”

“I didn’t read the report. I don’t read Arabic very well.”

The Iraqi court judge took note of the denial, as well as Merzoughi’s regrets and apologies. But after a short recess, he sentenced him to death anyway.

“The court finds that the evidence obtained against you is sufficient to prove that you joined an armed terror organisation. The court sentences you to death by hanging.”

Additional reporting by Enas Ibrahim