WÜRZBURG, Germany — The Islamic State claimed responsibility on Tuesday for a rampage by a 17-year-old Afghan migrant who attacked passengers on a regional train in southern Germany with an ax, and then seriously injured a woman who was walking her dog, before he was killed by the police. The train attack, around 9 p.m. Monday near Würzburg in Bavaria, wounded four visitors from Hong Kong, two of them critically. The woman walking her dog was hospitalized with serious injuries. The attack intensified fears in Germany that the huge influx of migrants and refugees could pose a security threat.