Sixteen individual organisations within the health service, some of them responsible for several hospitals each, had reported coming under attack, NHS said.
Sixteen individual organisations within the health service, some of them responsible for several hospitals each, had reported coming under attack, a spokesman for the National Health Service said.
"A number of NHS organisations have reported to NHS Digital that they have been affected by a ransomware attack," NHS Digital said in a statement.
It was not clear if the disruption was linked to cyber attacks also reported Friday on several major Spanish companies including telecom giant Telefonica.
The Spanish energy ministry said it had "confirmation of various cyber attacks targeting Spanish companies", adding that the attackers used ransomware which blocks access to files until a ransom is paid.
Britain's National Cyber Security Centre is assisting the investigation into the UK incidents, apparently caused by a piece of malware called Wanna Decryptor, it said.
"At this stage we do not have any evidence that patient data has been accessed," the NHS Digital statement said.
"This attack was not specifically targeted at the NHS and is affecting organisations from across a range of sectors," it added.
Several individual health service trusts in England reported severe problems with their computer systems and instructed patients to avoid their hospitals except in emergencies.
A spokesman for Barts Health NHS Trust in London said it was experiencing "major IT disruption" and delays at all four of its hospitals.
"We have activated our major incident plan to make sure we can maintain the safety and welfare of patients," the spokesman said.
"We are very sorry that we have to cancel routine appointments, and would ask members of the public to use other NHS services wherever possible.
"Ambulances are being diverted to neighbouring hospitals."
Two employees at St Bartholomew's Hospital in London, which is part of Barts Health, told AFP that all the computers in the hospital had been turned off.
"We have been told that we need to shut down all the computers and even our Wi-Fi on our phones. No computers are currently working," they said, speaking on condition of anonymity as they were not authorised to speak to press.
Derbyshire Community Health Services in central England said on Twitter: "We are aware of a major IT secure system attack. All IT systems have been temporarily shut down".
Blackpool Hospitals NHS Trust in northwest England, which includes six hospitals, said: "Please don't attend A&E unless it's an emergency" and "Please avoid contacting your GP practice unless absolutely necessary".