Video uploaded to YouTube shows the moment a runaway German teenager who joined Islamic State was captured by Iraqi troops in the ruins of Mosul.

The footage shows 16-year-old Linda W screaming, limping and being heckled by a group of men, thought to be Iraqi counter-terror troops, after her capture in the final days of the battle for the former IS stronghold.

The girl, from the German town of Pulsnitz, was reportedly radicalised online and went to the Middle East as a 15-year-old to marry a man fighting for the terrorist group.

Linda W, a 16-year-old German, was one of 26 foreigners arrested by the Iraqi military in Mosul.

A group of men surrounds her in the mobile phone footage, chanting as the teenager limps screaming along a street.

German media reported she had a gunshot wound on her left thigh and another injury on her right knee, which she said happened during a helicopter attack.

She was one of 26 foreigners arrested by the Iraqi military in Mosul, where Iraqi forces declared victory over IS last month.

If she stays in Iraq and is convicted of terrorism-related offences, she could potentially face the death penalty.

In a second video posted to Facebook, the same woman is seen with Iraqi forces. In this video, she speaks a few words in Arabic, then says in English her name is Linda.

Loading

After her arrest, she spoke to German media in the infirmary of a military complex in Baghdad, where she told them she wanted to leave.

"I just want to get away from here," she was quoted as saying.

"I want to get away from the war, from the many weapons, from the noise.

"I just want to go home to my family."

German media said the teenager told them she regretted joining IS, wanted to be extradited to Germany and would cooperate with authorities.

Last month, Iraqi Prime Minister Haider al-Abadi formally declared victory over Islamic State after what was dubbed the Battle for Mosul.

The fall of Mosul was the biggest defeat for the terror group since it declared a "caliphate" three years ago. The group still controls territory west and south of the city.

German authorities had been investigating Linda, who went missing last year, over alleged contacts with IS about preparing a possible act of terrorism.

Lorenz Haase, senior public prosecutor in Dresden, said after her arrest she was receiving consular support but he could not say anything about her exact circumstances.

He said the girl had travelled to Turkey about a year ago with the apparent goal of reaching Iraq or Syria and security officials had later lost her trail.

Germany's domestic intelligence agency estimated about 960 people had left the country to fight for IS and a number wanted to return.