BERLIN -- A teen armed with an ax and a knife attacked passengers aboard a regional train in southern Germany on Monday night, injuring four people before he was shot and killed by police as he fled.

The 17-year-old Afghan refugee with unclear asylum status attacked people on the train shouting Allahu Akbar, CBS News has learned.

Teen armed with an ax and a knife attacked passengers aboard a regional train in southern Germany. CBS News

Wuerzburg police said on their Facebook page that three of the victims suffered serious injuries and one was slightly injured. Another 14 people were being treated for shock.

Get Breaking News Delivered to Your Inbox

Police said there was not yet any information on the motive behind the attack.

Bavaria's top security official, state Interior Minister Joachim Herrmann, confirmed to Germany's ARD television that the attacker had been identified as a 17-year-old Afghan.

Germany last year registered more than 1 million migrants entering the country, including more than 150,000 Afghans, but it was not immediately clear whether the suspect was among them or someone who had been in the country for a longer time.

Herrmann said initial information was that the suspect came to Germany as an unaccompanied minor and had lived in the Wuerzburg area for some time, initially at a refugee facility in the town of Ochsenfurt and more recently with a foster family.

He said authorities were still investigating the motive of the attack and were looking into reports that the suspect had yelled out "an exclamation" during the rampage. He was responding to reports that some witnesses had heard the suspect shout "Allahu Akbar" ("God Is Great") during the attack.

The train was on its way from the Bavarian town of Treuchtlingen to Wuerzburg, which is about 60 miles northwest of Nuremberg.