Jurors heard how Danquah had struggled to accept his relationship with his partner was over and that they had continued to live together.
They also heard that the ex-partner had discussed a new relationship she was in and had made it clear they were not getting back together.
On the day of the incident, 2 July 2023, Danquah had collected the child from another address in the city and posted a message on Facebook saying he could not “continue to live in this darkness”.
He was spotted carrying the boy as he tried to climb over fence of a bridge in Anderston overlooking M8 motorway.
He was spoken to by a police officer and allowed to leave the area.
Danquah then went on to Garrowhill station where he, carrying the child, stepped in front of a train pulling into the station at about 19:20.
The child suffered grazes or bruises on the forehead, head, back, face and nose – and was described as looking shocked in the hospital.
Danquah sustained fractures to his lower spine and his jaw.
After the incident, Danquah was held at a mental health clinic in Glasgow before being discharged.
Gary Allan KC, defending, said what happened was “wholly out of character”.
Ch Insp Marc Francey said the child was now doing well, though officers could have “easily been looking at a very different investigation”.
The British Transport Police officer added: “Danquah’s actions that day were incomprehensible.
“He deliberately put a young child’s life in extreme danger and it is only through sheer luck that he wasn’t seriously injured or killed.”