This is screengrab taken from the website of the East and North Hertfordshire NHS trust as Britain's National Health Service is investigating "an issue with IT" Friday May 12, 2017. Several British hospitals say they are having major computer problems Hospitals in London, northwest England and other parts of the country are reporting problems with their computer systems as the result of an apparent cyberattack,.(PA via AP)

A large cyberattack crippled computer systems at hospitals across England on Friday, with appointments canceled, phone lines down and patients turned away.

Britain's National Health Service said hospitals were hit by an apparent "ransomware" attack, but there was no immediate evidence that patient data had been accessed.

NHS Digital, which oversees cybersecurity, says the attack used the Wanna Decryptor variant of malware, which infects and locks computers while the attackers demand a ransom.

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

NHS Digital said the attack "was not specifically targeted at the NHS and is affecting organizations from across a range of sectors." It said 16 NHS organizations had reported being hit.

Spain, meanwhile, said several Spanish companies had been targeted in ransomware cyberattack that affected the Windows operating system of employees' computers. It did not say which companies were targeted but telecommunications company Telefonica said it had detected a cybersecurity incident that had affected computers of some employees.

In the U.K., hospitals in London, northwest England and other parts of the country reported problems and asked patients not to come to the hospitals unless it was an emergency. Most of the affected hospitals were in England, but several facilities in Scotland also reported being hit.

This Friday Aug. 14, 2009 file photo shows a sign outside one of London's National Health Service hospitals. Several British hospitals say they are having major computer problems Hospitals in London, northwest England and other parts of the country are reporting problems with their computer systems as the result of an apparent cyberattack, Friday May 12, 2017. (AP Photo/Alastair Grant, File)

NHS Merseyside, which operates several hospitals in northwest England, tweeted that "following a suspected national cyberattack, we are taking all precautionary measures possible to protect our local NHS systems and services."

East and North Hertfordshire NHS Trust, which runs hospitals in an area north of London, said "the trust has experienced a major IT problem, believed to be caused by a cyberattack."

It said its hospitals had shut down all systems as a protective measure and canceled all non-urgent activity.

Bart's Health, which runs several London hospitals, said it had activated its major incident plan, cancelling routine appointments and diverting ambulances to neighboring hospitals.

Britain's National Health Service is a source of pride for many Britons but faces substantial budget issues and has had previous problems with its huge IT system.

Ransomware attacks are on the rise. In February 2016, the Hollywood Presbyterian Medical Center in California said it had paid a $17,000 ransom to regain control of its computers from hackers.

Krishna Chinthapalli, a registrar at the National Hospital for Neurology and Neurosurgery in London, warned that British hospitals' old operating systems and store of confidential patient information made them an ideal target for blackmailers.

Writing in the British Medical Journal, he said: "We should be prepared: more hospitals will almost certainly be shut down by ransomware this year."

Journal information: British Medical Journal (BMJ)