A purported video of the teenage Afghan refugee who attacked passengers on a German train with an axe has emerged.

Islamic State in Iraq and the Levant (Isil) on Tuesday released what it claimed was a video of the 17-year-old in which he threatens to carry out a suicide attack in Germany.

The teen was shot dead by police after he injured five people in the attack on Monday night. One is still in critical condition.

Isil named the attacker as Mohammed Riyad. His identity has not been officially released in Germany, but local media have named him as Riaz A.

“I am a soldier of the Caliphate. I will carry out a martyr attack in Germany. The time has come,” he says in the alleged video released by Isil’s Amaq online news agency.

Holding a knife in his hand, he claims the attack is revenge against the international anti-Isil coalition.

“The soldiers of the Caliphate will come to you. You will be slaughtered in your homelands, in your houses, in your countries,” he says.

“Know that the Islamic State is powerful. And it will target your parliaments.”

Witnesses described hearing the teen shouting “Allahu akbar” as he attacked passengers with an axe on a regional train in the suburbs of Würzburg on Monday night.