He was arrested by gardaí involved in a policing plan targeting anti-social behaviour on the train network.
The child did not fall and was uninjured but the man was taken to Kildare garda station where officers reported him to the child protection agency Tusla.
Gardaí were able to react to the potentially disastrous situation in late September because they were travelling on a train under the special operation run by officers from four counties.
The arrest was one of about 15 made by gardaí in 90 “days of action” so far this year focusing on commuter train lines going in and out of Dublin Heuston on the Portlaoise and Carlow lines.
The initiative has been considered such a big success that Irish Rail say it is considering introducing it to other train lines, including the DART.
According to figures obtained by the Irish Independent, gardaí have searched more than 130 people this year, and of the almost 20 people arrested on trains travelling on the Heuston rail corridor, the majority have been for drugs and public order offences.
This includes what is described as a “significant drug seizure on a local level” in Athy recently.
Officers from Kilmainham, Ronanstown, Lucan, Leixlip, Naas, Kildare, Newbridge and Portlaoise garda stations have all been involved in the weekly operations which sometimes involve the deployment of undercover gardaí as well as the dog unit on trains and in stations in an attempt to detect illegal drugs.
In the last two months officers from Carlow garda station have also became involved in the commuter train policing plan.
Already this year more than 1,100 people have been fined for fare evasion by Irish Rail staff on the trains being patrolled by gardaí from the four different Leinster counties.
“Each garda district in these areas provides two to three officers on a rotational basis which involves these gardaí being on the trains with Irish Rail staff on the days of action,” a senior source said.
“In the course of a typical day of action of which there has been almost 90 days this year, gardaí travel on at least eight different commuter trains on the lines in and out of Heuston.
“The aim of this operation is to prevent anti-social behaviour, drug use and drugs transportation and it has been a success as reports of anti-social behaviour on commuter trains has decreased dramatically in the past year,” the senior source said.
Anti-social behaviour remains a serious problem throughout the Irish Rail system.
According to figures published in late August, there were 763 incidents involving anti-social behaviour in the first six months of this year.
They included multiple reports of fighting, soiling, sexual harassment, lewd behaviour and hate incidents on trains, many of which involved drugs or alcohol.
Nearly half of the incidents took place on DART services in the capital, while the remainder occurred on Irish Rail’s intercity routes.
A further 82 incidents were reported during the first three weeks of July, bringing the average number of anti-social behaviour complaints each month to 125, despite Irish Rail spending €5.7m on security last year.
More than 50 incidents involved fighting, while lewd behaviour was the subject of 16 complaints over the six-month period – six of which related to DART services.
Six incidents involved soiling, four of which occurred on the DART.
“It is clear that a lot of the problems that are happening are on the DART so that is why there is active consideration to extending the successful policing model that is in place on the Heuston rail corridor to this service in Dublin,” an Irish Rail source said.
The policing plan on the Heuston commuter trains has been in place since April of last year and means that Irish Rail management and gardaí can formally meet on a regular basis to identify particular issues that need to be targeted on a specific day or a specific service.