The married father-of-three, identified by German media as 40-year-old Habte A., had also undergone psychiatric treatment this year, said police in the Swiss canton of Zurich where he lived.
Last Thursday, he had flown into a rage and threatened a neighbour with a knife and locked her up, and also trapped his wife and their children, aged one, three and four, in their flat before running away.
The outbreak of violence was surprising according to his wife and neighbour, Swiss police said. "They unanimously stated that they had never seen him like this before," a police spokesman said.
Spiegel Online reported that the asylum seeker who had lived in Switzerland for 13 years had worked in tram maintenance for the Zurich Transport Authority since early last year.
READ ALSO: Man accused of pushing boy under train is father of three
German prosecutors laid murder and attempted murder charges against the man over the attack Monday that left eye-witnesses in need of trauma counselling and shocked the nation.
He allegedly also pushed the boy's mother onto the tracks at Frankfurt's main station, and tried but failed to do the same to a 78-year-old woman.
"While the mother could roll off after the fall and move herself onto a narrow footpath between two tracks, her child was caught by the arriving train and died, on the spot, of his injuries," said a statement by Frankfurt
The man ran down a platform and across tracks but was followed by passers-by including an off-duty officer, and overpowered by police two blocks from the station.
The suspect did not previously know the victims and showed no signs of alcohol or drug use, prosecutors spokeswoman Nadja Niesen said.
"The crime suggests a psychiatric disorder," she told a press conference, adding that an examination would ascertain the level of his criminal culpability.
SEE ALSO: 'More police needed': Killing of child puts focus on security in Germany's train stations
The horrific crime has dominated newspaper front-pages and TV news bulletins, and led politicians to call for heightened security, more camera surveillance and tighter border controls.
Citizens have laid flower wreaths, candles and stuffed toys at the site of the killing and a memorial service was scheduled at the station in the evening.
Interior Minister Seehofer had cut short his summer holiday to meet the heads of major security agencies in Berlin.
Seehofer emphasized that although the general crime rate in Germany is decreasing, people could be feeling "very tense" about security.
There will now be top-level discussions between agencies about how security at railway stations in Germany can be improved. Seehofer demanded a greater police presence at railway stations, echoing calls from other politicians in Germany.
Motive still unknown
Prosecutors spokeswoman Niesen said the man in custody had not yet spoken about a motive.
If formally charged, tried and then found guilty, he would face a likely term of life in prison, she said.
In a similar case earlier this month, a 34-year-old mother died after being pushed in front of a train, allegedly by a Serbian man.
Germany's far-right has seized on both killings to once more criticise what it regards as the flawed immigration policies of Chancellor Angela Merkel's government.
SEE ALSO: Woman dies after being pushed in front of oncoming train near Duisburg
With reporting from Frank Zeller