Abdel-Majed Abdel Bary, 32, who is accused of posting a photo of himself with a victim’s severed head online, was found dead in a Spanish prison on Wednesday, the ministry said.
The cause of death is yet to be confirmed.
The former rap artist was detained at Puerto III prison in the southern Spanish city of El Puerto de Santamaría, AP reported.
He was awaiting a verdict from a trial that ended on July 14 and faced up to nine years in prison if convicted.
A prison officer who maintained daily contact with Abdel Bary said that his body showed no signs of violence.
Abdel Bary had been under strict rules that included 20 hours a day of solitary confinement.
He had not been a problem inmate and was not on any psychiatric treatment, the officer said.
Militias who played a vital role in defeating ISIS - in pictures
Abdel Bary left London in 2013 to join an Al Qaeda faction and later ISIS militias in Syria.
Before joining ISIS in Syria, Abdel Bary performed as a rapper under the name Jinn.
He was the son of an Egyptian operative of Al Qaeda who was convicted for events related to the 1998 bombings at US embassies in Africa that killed 224 people.
Abdel Bary stopped making music not long after his father’s extradition to the US on terrorism charges.
Spanish police arrested Abdel Bary and two other men in April 2020, shortly after they crossed the Strait of Gibraltar on a skiff from Algeria.
He was accused of leading a terror cell formed by him and the two other men, dedicated to committing internet banking scams and trafficking in cryptocurrencies to “finance their terrorist activities".
Abdel Bary denied being a cell leader during the trial.