Defence Secretary Michael Fallon has refused to deny that Britain’s nuclear submarines use the outdated Windows XP program amid the ongoing WannaCry ransomware attack.

Instead he simply insisted the subs were “safe”, adding that they operated “in isolation” when out on patrol, which possibly suggests the vessels at sea were unaffected only because they were not connected to the internet.

The malware has prevented computers from being used all over the world in companies and government departments, with the NHS particularly badly hit. At one point nearly a fifth of NHS trusts were affected by the virus.

Windows XP is now largely unsupported by Microsoft, although the firm issued a special patch to prevent WannaCry from infecting computers still using it because of the extent of the attack.

The hackers used a technique described in leaked files from the US National Security Agency to spread the ransomware by exploiting weaknesses in Windows XP.

Mr Fallon was asked on the BBC’s The Andrew Marr Show if it was true that the UK’s nuclear submarines still used the operating system.

“We never comment on the defence systems, obviously for reasons of security, that our submarines use,” he replied.

“But our Vanguard submarines, I can absolutely assure you, are safe and operate in isolation when they are out on patrol.

“I have complete confidence in our nuclear deterrent. I can assure you the nuclear deterrent is fully protected.”

Mr Marr also suggested the Government had failed to ensure the NHS was properly protected by cyber attacks.

Mr Fallon replied: “In our security review just over a year and a few months ago, we identified cyber threats as one of the three principal threats and we set aside £1.9bn to protect use against cyber [attacks].

“A large chunk of that went to the NHS. We spend around £50m on the NHS cyber systems to improve their security.”

The WannaCry attacks have faltered as Microsoft issued software patches to defend against it but people still need to update their computers.