GENEVA — The United Nations said Friday that it was appalled by a mass execution of prisoners in Iraq and called for an immediate halt to executions, citing flaws in the country’s criminal justice system.

Iraq’s Ministry of Justice said 38 prisoners were executed on terrorism-related charges in the southern city of Nasiriya on Thursday, but it gave no details of the prisoners’ identities or the offenses for which they were sentenced to death.

“Given the flaws of the Iraqi justice system, it appears extremely doubtful that strict due process and fair trial guarantees were followed in these 38 cases,” Elizabeth Throssell, a spokeswoman for the United Nations human rights office in Geneva, told reporters. “This raises the prospect of irreversible miscarriages of justice and violations of the right to life.”

Iraqi courts are dealing with thousands of prisoners, including foreigners and hundreds of children, some as young as 13, who were detained in the past two years because they were suspected of being Islamic State fighters or supporters.