A 17-year-old Afghan asylum-seeker who went on a rampage on a Bavarian train with an ax and a knife appears to have acted alone, goaded on by online Islamic extremist propaganda, Germany's top security official said Wednesday.

Five people were wounded in the attack near Wuerzburg, including four members of a Hong Kong family, and two of the wounded remain in critical condition.

"It is not yet clear if they will all survive," German Interior Minister Thomas de Maiziere told reporters in Berlin.

The federal prosecutor's office in Karlsruhe, which investigates terrorism, said it was taking over the case because of ISS' claim of responsibility and a video posted by the group in which he refers to himself as a "soldier of the Islamic State [ISIS]." It said that investigators were trying to see if the suspect had accomplices or mentors.

De Maiziere said it was not yet clear when the video was made, but confirmed that investigators had determined it was authentic. It shows the young man, whose name has not been released by authorities, waving a knife as he talks into the camera.

"It appears to be a classic farewell video of a suicide attacker," de Maiziere said.

Still, he added it was difficult to say whether the train attack was an act of terror or an attack by a disturbed individual.

"It might be an incident on the thin line between killing spree and terror," de Maiziere said.

In the video, the suspect urges others to commit attacks.

"If you can't come to Iraq and Syria, the least you can do is kill these infidels in the countries that you live in," he says.

The suspect speaks in Pashto, one of Afghanistan's main languages. He has an eastern accent similar to that of Pakistanis who speak Pashto, leading to speculation that he may have lied about his homeland when he came to Germany last year as an unaccompanied minor asylum-seeker to increase his chances of being allowed to stay.

De Maiziere said authorities were looking into the possibility that he might have been from Pakistan, but other evidence suggest his being from Afghanistan, including comments he made about a friend in Afghanistan having recently been killed — something authorities think may have prompted him to plan his attack.

Germany has not experienced the large, deadly attacks that France and Belgium have, although a string of sexual assaults and robberies on New Year's Eve in Cologne that prosecutors say were committed largely by foreigners gave rise to fears of whether the country could cope with the 1 million migrants it registered in 2015.

De Maiziere said when authorities have investigated information received about refugees with alleged connections to terrorism, it's almost always proved false, but there are still tips being looked into.

"One can't say there is no connection between refugees and terrorism," he said, but added that even without any refugees, the danger of a terrorist attack would still be considered high.