An Iraqi court has sentenced a French woman to life in prison for membership in the Islamic State (IS) extremist group.

Melina Boughedir, a mother of four, was initially sentenced to six months in prison for entering the country illegally.

However, the court ordered a retrial after prosecutors presented new evidence, including photos of her French husband posing with IS fighters.

On June 3, Boughedir, 27, was found guilty of belonging to IS and handed a life sentence -- which in Iraq is equivalent to 20 years.

The verdict can be appealed.

Boughedir appeared in court with her 2-year-old daughter. Her three other children are now back in France, the AFP news agency said.

Boughedir told the judge that she was “duped” by her husband, who allegedly “threatened to leave with the children" unless she followed him to Iraq, where he planned on joining IS.

Boughedir's husband is believed to have been killed in Mosul, during an operation to recapture the Iraqi city from IS militants.

Boughedir, who was detained in Mosul last year, was represented by three lawyers.

Last week, French Foreign Minister Jean-Yves Le Drian said that Boughedir was a "combatant" and a IS “terrorist.”

"When you go to Mosul in 2016, [you go] to fight, so she is judged on the location of her actions...She fought against Iraqi units, she is judged in Iraq,” the minister said on French television channel LCI.

Iraq detained thousands of people, including hundreds of foreigners, as it recaptured Mosul and other areas from the militants.

Based on reporting by AP and AFP