The Hampshire Hospitals Trust has been struck by a massive cyber attack threatening to delete NHS files unless a ransom is paid.

Around the country, ambulances have been diverted and patients were warned to avoid some A&E departments after systems were targeted on Friday.

It was thought that all three of the Hampshire Hospitals NHS Foundation Trust hospitals had been affected but the trust has since confirmed it was only Basingstoke and North Hampshire Hospital.

A spokesman for the Hampshire Hospitals NHS Foundation Trust said: "Following the national cyber attack, we can confirm that there has been no loss of patient or other data at Hampshire Hospitals NHS Foundation Trust.

"The attack affected x-ray facilities and a small number of computers linked to CT scanners.

"There has been no need to cancel any clinics or operations. Staff have worked very hard to avoid disruption to patients and to minimise impact on our services, while our contingency and emergency plans worked well."

A statement on the Hampshire Hospitals NHS Foundation Trust website said: "Like several other trusts across the country, Hampshire Hospitals NHS Foundation Trust is currently experiencing a cyber attack, which is affecting some services.

"We have plans in place to manage and respond to incidents such as this and are working with the ambulance service and our other partners both locally and nationally to minimise any impact on patient care.

"We are asking the public to consider whether they need to attend our emergency departments. The NHS 111 service is also available for healthcare advice."

NHS Digital said 16 organisations within the health service had seen their IT systems affected as of 3.30pm on Friday by a ransomware attack, using malware called "Wanna Decryptor".

An NHS Digital spokesman said: "At this stage we do not have any evidence that patient data has been accessed."

Pictures posted on social media showed screens of NHS computers with images demanding payment of 300 US dollars worth of the online currency Bitcoin, saying: "Ooops, your files have been encrypted!"

It adds: "Maybe you are looking for a way to recover your files, but do not waste your time."

It demands payment in three days or the price is doubled, and if none is received in seven days the files will be deleted.

The National Cyber Security Centre said it was aware of a "cyber incident" and was working with NHS Digital and the National Crime Agency to investigate.

Prime Minister Theresa May said the ransomware hit was "not targeted" at the health service but was part of a wider assault on organisations across a number of countries.

Mrs May added: "We are not aware of any evidence that patient data has been compromised."

Security chiefs and ministers have repeatedly highlighted the threat to Britain's critical infrastructure and economy from cyber attacks.

Southampton General Hospital had not been hit by the attack at the time of writing.