Media playback is unsupported on your device Media caption The train hit the men while they were on the tracks near Margam

Two rail workers who died after being hit by a passenger train were wearing ear defenders and may not have heard it coming, police say.

The men, aged 58, from North Cornelly, and 64, from Kenfig Hill, were struck near Margam by the Swansea to London Paddington train at about 10:00 BST.

The pair were pronounced dead at the scene and a third person was treated for shock, but was not injured.

Network Rail said it was "shocked and distressed" by the incident.

British Transport Police (BTP) Supt Andy Morgan said: "Following a number of urgent enquiries into this tragic incident, it has been established that the three people were railway workers who were working on the lines at the time.

"The initial stages of the investigation suggest that the two men who died had been wearing ear defenders at the time, tragically, could not hear the passenger train approaching.

"We have a number of officers who remain in the area and we are continuing to work alongside the Rail Accident Investigation Branch to understand the full circumstances of what happened in the moments before this incredibly sad, fatal collision."

Bill Kelly, Network Rail's route managing director for Wales, added: "We are fully cooperating with the British Transport Police and Rail Accident Investigation Branch.

"Our thoughts are with the families of our colleagues and our members of staff who will be affected by this tragic loss, and we will provide all the support we can."

Image caption Police and the Rail Accident Investigation Branch are investigating

The tragedy happened just three months after the Rail Accident Investigation Branch warned there were "too many near misses in which railway workers have had to jump for their lives".

In 2018 there was one death on the mainline railway and 6,641 injuries, of which 164 were major.

Great Western Railway (GWR) said about 180 passengers were on the train at the time of the incident.

One passenger said a party of school children were on board, and they had had to shut the blinds in the carriage to prevent them seeing what was happening outside.

The train has since been moved and the line reopened just before 21:00 but GWR said replacement bus services will continue to operate to supplement trains between Swansea and Cardiff Central stations.

The company said in a statement: "Everyone at GWR is incredibly saddened to learn that two railway colleagues lost their lives this morning, when they were struck by the 0929 service from Swansea to London Paddington.

"We have offered our full assistance to the British Transport Police, the Rail Accident Investigation Branch, and Network Rail as they seek to understand the circumstances which led to this tragic accident."

Passengers started being evacuated from the train around three hours after the crash and were put on buses to Port Talbot and Cardiff.

One passenger who was on board the train said: "This happened shortly after we left Port Talbot Parkway. We didn't hear anything at all. We weren't even aware an incident had taken place until the train manager made an announcement."

Image caption Stephen Lester could see "devastated" rail staff out of the window

Stephen Lester, who was also on board, said: "[I] looked out of the window and saw people standing around looking at the floor.

"They were devastated that one or maybe two of their colleagues was under the train."

He said the blinds had to be pulled down as there were secondary school children from Swansea in the carriage. A teacher travelling with around 30 pupils said they had been on a trip to London, adding that rail staff had been "absolutely amazing".

Media playback is unsupported on your device Media caption Passengers on the train which killed two rail workers describe how events unfolded

Arriving at Port Talbot Parkway, passenger Auriel Griffiths from Cimla, Neath Port Talbot, said: "It was a bit of an experience really… thank God the train didn't turn over."

She had been travelling to visit a relative in hospital when the incident happened.

She said staff on the train had been "very good". "They kept coming along and giving us information, coffee and water," she said.

Describing the moment the train came to a standstill, she said: "It just sort of stopped. I didn't feel a bang or anything…

"People got killed, that's worse than being inconvenienced isn't it… I feel upset about it."

Image caption Robert Jones praised the train staff for their handling of the incident

Fellow passenger Robert Jones, from Neath, who was travelling with his wife, said it had seemed as if the train was stopping because of the works which were going on.

"There was no sound, there was no particular judder, there was no commotion.

"Quite soon after the announcement was made that a major incident had occurred," he said, adding two further announcements were made explaining what had happened. "It became evident that it was a tragedy."

Mr Jones said it was difficult in the hours that followed, knowing people had lost lives, but said: "Every single passenger in my coach dealt with it in the most remarkable way. They accepted the situation that there would be a delay and the staff were just unbelievable all round."

Image copyright Aled Llywelyn Photography Image caption About 180 passengers were on the train at the time of the incident, Great Western Railway said

The Rail, Maritime and Transport union general secretary Mick Cash called for a suspension of all similar works by Network Rail "until the facts were established" following the "shocking news".

His counterpart at the Transport Salaried Staffs' Association, Manuel Cortes, said it was not acceptable for people to "go out to work and end up losing their lives".

Labour leader Jeremy Corbyn spoke about the incident at Prime Minister's Questions.

He said: "I'm sure the whole house will want to express their condolences to the families of those rail workers who were hit and killed by a train this morning in Port Talbot."

Image copyright Aled Llywelyn Photography Image caption UK and Welsh ministers expressed their condolences after the fatal crash

Prime Minister Theresa May said she shared his sentiments.

Speaking in the Senedd, Welsh government deputy transport minister Lee Waters said the government and the assembly was "deeply shocked", adding: "It's hard to understand how this could have happened this morning just 20 or so miles away from us."

UK Transport Secretary Chris Grayling said there would be an investigation into how the accident happened, adding: "I will ensure lessons are learned".

He said he was "deeply saddened" and sent his condolences to the family, friends and colleagues of the workers.

Image caption Two ambulances as well as vehicles from the Hazardous Area Response Team and Wales Air Ambulance were sent to the scene

Wales' Transport Secretary Ken Skates tweeted: "Deeply shocked by the news about the tragic incident involving railway workers near Margam this morning, and my thoughts are with the families of those involved."

MP for Aberavon Stephen Kinnock added: "I'm very concerned to see reports of the tragic accident on the rail line between Bridgend and Port Talbot... This is awful news, and my thoughts are with the families of all concerned."