One person has died and three others have been injured after a man wielding a knife launched an attack at a train station in southern Germany.

Police arrested the suspected attacker after he was overpowered at the station in Grafing, 25 miles south-east of central Munich. A spokesman said the 56-year-old victim, whose age was initially given by authorities as 50, was wounded by the attacker on a commuter train and died later in hospital.

Three other men – aged 43, 55 and 58 – were also injured, one of whom is in a critical condition, according to the police.

Bavaria’s interior minister, Joachim Herrmann, said the suspect, a 27-year-old German man from Hesse identified only as Paul H, apparently had psychological problems and drug issues.

Despite earlier indications, an Islamic extremist motive was ruled out, though investigators are still looking at whether there was a political context to the attack.

In an earlier statement a spokesman for the Bavarian prosecutors’ office had said the suspect “made remarks at the scene of the crime that indicate a political motive – apparently an Islamist motive”.

One investigator said he had shouted: “Infidels, you must now die.”

Police had said according to initial unverified witness accounts, Paul H, a carpenter who has been unemployed for two years, shouted “Allahu Akbar” (“God is greatest”) during the attack, which happened at about 4.45am local time (0245 GMT).

Speaking at a press conference, Günther Gietl of the Bavarian police said a knife with a 10cm blade had been found in his belt when they arrested him. He said investigators had not excluded the possibility that Paul H had converted to Islam.

But Lothar Köhler, director of the criminal police in the region, said so far there was “no evidence of any kind” that Paul H had undergone any sort of political radicalisation. “We found no relationship to Islamists, Salafist groups or other persons,” he said.

It was not known, he added, if the suspected attacker had been under the influence of drugs when he carried out the attack.

One investigator told German media that Paul H appeared confused and was uncooperative. “It’s as if he’s closed up,” the investigator said. Another team of investigators is searching through Paul H’s Gießen flat.

Deputy chief of the regional criminal police, Petra Sandles, said the town of Grafing appeared to have been a “randomly chosen crime scene”, adding that the suspect had travelled to Munich by train on Monday. Having not had enough money for a hotel, he had taken refuge in Munich’s central station, travelling from there to Grafing on Tuesday morning.

Speaking in Berlin, Germany’s interior minister, Thomas de Maizière, called the incident a “cowardly attack”, adding that its motivation “has not been finally investigated” and that it was “important to ascertain all the correct details” before any conclusions were drawn.

The railway station was cordoned off by police leading to restrictions on Munich’s S-Bahn rail network. Large quantities of blood were visible on the floor of the train, which stood with open doors on the platform as forensic scientists worked at the scene.

Angelika Obermayr, the mayor of Grafing, described it as “an absolutely peaceful little Bavarian town”. She said: “Something like this is absolutely new and shakes people deeply. That it could happen here is absolutely stupefying.”

Witnesses described how the man had suddenly struck out at commuters, wielding a 10cm-long blade and appearing to randomly stab at his victims. The first victim was struck down in the S-Bahn train, while another was attacked on the platform. Two of the victims were cyclists who had apparently come to give first aid to the earlier victims. One of their bikes could be seen abandoned on its side on the road in front of the station in an area cordoned off by police.

While the police said the suspect was not previously known to them, it has emerged that he came to their attention on Sunday at a techno demonstration when he was discovered with drugs which he had “consumed massively,” a spokesman said.

CCTV cameras at the railway station and on the train which recorded the incident are now being analysed by investigators.

The incident triggered considerable nervousness across the country, reflecting the sense that Germany faces the constant threat of a terror attack because of its close involvement in the fight against Islamic State. Security forces remain on high alert.