Portsmouth Coroner’s Court heard that Robert McQuoid left his flat on the morning of September 23 intending to end own his life.
The 59-year-old went on to the track between St George’s Road and Burnaby Road in Portsmouth.
Police sergeant Derek Bish from British Transport Police told coroner David Horsley how Mr McQuoid died.
Train driver Gary Anderson, of South West Trains, submitted a statement, which was read out by Sgt Bish. It said Mr Anderson was driving the 5am train from Portsmouth Harbour to Basingstoke.
Mr Anderson said he saw a man come out of the undergrowth and get onto all fours on the track, looking at the train. Mr Anderson pulled the emergency brake but Mr McQuoid was hit.
Mr Anderson pushed the emergency button to inform all trains and said he thought the man was dead.
After Mr Anderson found Mr McQuoid was still alive, Sgt Bish arrived and said Mr McQuoid was conscious and in great pain.
Sgt Bish said: ‘I held the male’s hand and kept talking to him to keep him conscious.
‘He said to me “I wanted to take my own life”.
Mr McQuoid was taken to Southampton General Hospital where he died.
His sister Sharon Hallisey said her brother’s mental health problems started three years ago when he believed he had cancer of the oesophagus.
She said: ‘When the results came back, they were clear but he was not dealing with things at that point.’
The dad-of-three, who was described as a football lover who had followed Manchester United across Europe, was due in court hours later on September 23.
He had previously been found guilty of actual bodily harm and was sentenced to 12-month prison sentence, suspended for one year.
He was also given a two-year mental health treatment requirement but failed to answer the door to staff from Solent NHS’s adult social care department on numerous occasions after initially working with them and was due back in court accused of breaking the terms of the treatment order.
For Mr McQuoid’s court date last year, Mrs Hallisey was on holiday and his son could not attend but a staff member from the adult social care department had agreed to go with him. Mr Horsley said: ‘It is so sad his illness prevented him going along with everyone wanting to help. He has taken his own life and suffered from long-term mental health problems.’