A German national stabbed four passengers at a train station near Munich early on Tuesday, killing one man and injuring three, in an attack police said appeared to have an Islamist motive.
Witnesses said the assailant, a 27-year-old man, shouted "Allahu Akbar" ('God is Greatest' in Arabic), according to police.
"The perpetrator made remarks during the attack which point to there being a political motive," Bavarian police said in a statement, adding he had been arrested and there were no further suspects.
A 50-year-old died of stab wounds in hospital shortly after the attack. The other stabbed men, aged between 43 and 58, sustained lighter injuries, police said.
The attack took place at about 5 a.m. local time (0300 GMT) at the train station at Grafing, a commuter town about 32 km (20 miles) southeast of the Bavarian capital in southern Germany.
Germany, which is playing a supporting role in the fight against Islamic State, has not suffered a major attack by Islamist militants on the scale of those that have hit neighburing France and Belgium.
But ministers have repeatedly warned an attack is possible and German security services are on alert.
Over 800 home-grown radicals have left Germany to join jihadist groups in Syria and Iraq and about 260 have returned.
Germany has also been a transit country for militants who carried out attacks in Belgium this year and Paris last year. There are concerns that some of the more than 1 million migrants who arrived in the country last year have slipped off officials' radar.