Ithawi, who used the alias Abu Zaid al-Iraqi, was captured in a joint operation by Iraqi, U.S. and Turkish intelligence agencies in February and had been providing information to Iraqi authorities, including coordinates for airstrikes on targets in Syria, Iraqi officials said.

His capture, along with four other important figures he helped authorities track down, was touted by President Trump in a tweet in May, and experts believed he could help authorities locate Baghdadi. Last month, Baghdadi released an audiotape, apparently intending to prove that he was still alive.

Ithawi is the most prominent member of the Islamic State, which is also known as ISIS and at its peak controlled one-third of Iraq, to have faced trial in Iraq and is among more than 300 Iraqis and foreigners, including women, to have been given death sentences.

It was not clear why Ithawi was given a death sentence despite his cooperation with authorities.

An Iraqi judge with knowledge of Ithawi’s trial, who spoke on the condition of anonymity to discuss legal deliberations, said Ithawi’s cooperation had indeed helped authorities track down other Islamic State figures. But under Iraq’s anti-terrorism law, cooperation does not guarantee immunity from prosecution or from a maximum sentence, the judge said.

“If we arrest Baghdadi, no matter how much he cooperates, he will get the death sentence,” the judge said in an interview. “This is the least we can do for the victims of the Islamic State.”

The judge added that Ithawi was represented by a public defender but declined to say how long the proceedings took.

Human rights groups have criticized Iraq’s anti-terrorism law as giving prosecutors too wide a berth. Scores of people who were coerced into helping the Islamic State, working as cooks, cleaners or doctors for the group, have faced trial and have been sentenced to life in prison or death.

Terrorism trials in Iraq typically last only minutes, with judges handing down harsh sentences on the basis of coerced confessions. Defense attorneys have complained that they are often not given any opportunity to mount a case.