Britain has blamed North Korea for a ransomware attack this year that a new report revealed affected a third of English hospitals and could have been prevented with "basic" IT security.

"This attack, we believe quite strongly that it came from a foreign state," Ben Wallace, a junior minister for security, told BBC Radio 4's Today programme.

"North Korea was the state that we believe was involved in this worldwide attack," he said, adding that the British government was "as sure as possible".

The WannaCry attack last May infected some 300,000 computers in 150 countries, including in Britain's National Health Service (NHS), Spanish telecoms company Telefonica and US logistics company FedEx.

Britain's National Audit Office (NAO) revealed the attack had hit NHS England particularly hard, forcing the cancellation of some 19,500 medical appointments.

Computers at 81 hospital groups across England were affected - a third of the total number of 236.

Some 600 general practitioners were also affected.

The facilities affected were running computer systems - the majority Windows 7 - that had not been updated to secure them against attacks, the NAO said.

"It was a relatively unsophisticated attack and could have been prevented by the NHS following basic IT security best practice," NAO chief Amyas Morse said.

"There are more sophisticated cyber threats out there than WannaCry so the Department (of Health) and the NHS need to get their act together to ensure the NHS is better protected against future attacks," he said.

The report revealed that there had been multiple warnings ahead of the attack about the weakness of IT security in the NHS but that recommendations for security updates were not respected.

Dan Taylor, the NHS Digital's head of security said the NHS had "learned a lot" from WannaCry, calling it "an international attack on an unprecedented scale".

Ransomware attacks use a type of malware that encrypts files on an infected computer and demands money to unlock them.

The NAO said no ransom was paid by the NHS but the government "does not know how much the disruption to services cost."