BERLIN — A youth described as an Afghan refu­gee attacked passengers with an ax late Monday aboard a German commuter train, injuring at least four people before being shot and killed by police, authorities said.

Three of the victims sustained serious injuries before the assailant fled from the train and was confronted by police officers in the southern German province of Bavaria. The youth shouted “Allahu Akhbar”--Arabic for ‘God is great” — before he was shot, two German security officials said.