Hackers have the ability to tap into a new rail signal system being trialed in the UK and cause oncoming trains to crash into one another at full speed, an internet security expert has warned.

A horrible accident is “waiting to happen” as the new digital system intended to make train lines safer could easily be exposed to malicious software and accessed by terrorists.

READ MORE: Britain 'most cyber-attacked country' in Europe - report

Experts fear the new system’s “lack of security” has the capability to cause carnage around the UK, especially if they are hacked by the wrong people.

Professor David Stupple, an internet security expert from City University, told the BBC he predicts the new system will cause a “nasty accident” involving terrorists as they can “easily expose the new mainframe.”

“It’s the clever malware that actually alters the way the train will respond,” he added.

The malware could perhaps “tell the system the train is slowing down, when it’s speeding up,” he told the broadcaster.

However, Stupple says the government “aren’t complacent” as they are completely aware of the dangers of the trails. “They are worried about it,” he added.

Stupple highlights the government’s awareness of the dangers, and claims they are working on measures to prevent an attack occurring. “Safeguards are going in, in secret,” he said.

READ MORE: DEA spending millions on spyware from foreign cyber vendors - report

However, despite the government’s efforts to prevent hacks, it is still possible for terrorists to “get around them,” he added.

Network Rail, which is in charge of the train line upgrade, expects it to be fully operational by the 2020s. It confirms it has acknowledged the potential threat.

A spokesperson for National Rail told the BBC they know the risk of a cyber-attack “will increase as we continue to roll out technology across the network.”

The spokesperson says National Rail will “work closely with the government, the security services, our partners and suppliers in the rail industry and external cyber-security specialists to understand the threat to our systems and make sure we have the right controls in place.”