The 40-year-old, who has lived in Switzerland for over a decade and has three small children, hasn't yet given any explanation for a possible motive for the killing that has horrified Germany, said Nadja Niesen, a spokeswoman for prosecutors in Frankfurt.
The boy's mother and then the 8-year-old were pushed onto the tracks as a high-speed ICE train was pulling into the Frankfurt station, one of Germany's busiest, on Monday morning. The 40-year-old mother managed to get out of the train's path but the boy was run over and killed.
The suspect then apparently tried unsuccessfully to push a third person, a 78-year-old woman, onto the track before fleeing. She fell and suffered a shoulder injury. The man, whose name has not been released, was chased by passers-by, including an off-duty police officer, and arrested near the station.
A judge ordered him held in custody pending possible charges of murder and attempted murder. Niesen said the nature of the crime raises the possibility of mental illness and a psychiatric assessment will be conducted. Swiss authorities later told reporters the man had undergone psychiatric treatment this year.
The suspect, who lived in the Zurich region, told German investigators that he took a train from the Swiss city of Basel to Frankfurt a few days ago. He arrived in Switzerland in 2006 and applied for asylum, which he obtained in 2008, said Dieter Romann, the head of Germany's federal police. He had a long-term residence permit in Switzerland and worked there, and was considered well-integrated.
However, on July 25, he is alleged to have threatened a woman who lived next door with a knife and locked her in her apartment before fleeing, Romann said. Swiss authorities were seeking him, but he was not in German or other European databases, he added.
Zurich regional police chief Werner Schmid said officers called to the scene last week also found the man's wife and three small children locked inside their apartment. He told reporters in Zurich "the outbreak of violence was a surprise to his wife and to his neighbor."
Politicians from the far-right Alternative for Germany party seized on the case to assail the German government's immigration policies. Alternative for Germany has long attacked Chancellor Angela Merkel's welcoming approach to an influx of refugees and other migrants in 2015.
Interior Minister Horst Seehofer said "we neither exploit nor play down crime by foreigners." Seehofer, speaking after he interrupted his vacation to meet with German security chiefs, said his ministry, the transport ministry and the German railway will discuss what can be done to improve security at German train stations.