Dozens of hospital trusts across the country have been hit by a huge cyber attack, plunging the NHS into chaos.

IT systems appear to have broken and emergency patients are being diverted to other areas, with hospitals across England and Scotland affected.

The NHS was just one of the victims of the huge attack, which spread across the world infecting computers in 74 countries in Europe and Asia.

On Friday night, US firm Fedex announced its operations in the US were also affected. Russia's interior and emergencies ministries, as well as the country's biggest bank, Sberbank, also said they were targeted.

The hack appears to be an example of ransomware – malicious hackers breaking into computers and only allowing their owners back in when they pay enough money.

Gadget and tech news: In pictures Show all 25 1 /25 Gadget and tech news: In pictures Gadget and tech news: In pictures Gun-toting humanoid robot sent into space Russia has launched a humanoid robot into space on a rocket bound for the International Space Station (ISS). The robot Fedor will spend 10 days aboard the ISS practising skills such as using tools to fix issues onboard. Russia's deputy prime minister Dmitry Rogozin has previously shared videos of Fedor handling and shooting guns at a firing range with deadly accuracy. Dmitry Rogozin/Twitter Gadget and tech news: In pictures Google turns 21 Google celebrates its 21st birthday on September 27. The The search engine was founded in September 1998 by two PhD students, Larry Page and Sergey Brin, in their dormitories at California’s Stanford University. Page and Brin chose the name google as it recalled the mathematic term 'googol', meaning 10 raised to the power of 100 Google Gadget and tech news: In pictures Hexa drone lifts off Chief engineer of LIFT aircraft Balazs Kerulo demonstrates the company's "Hexa" personal drone craft in Lago Vista, Texas on June 3 2019 Reuters Gadget and tech news: In pictures Project Scarlett to succeed Xbox One Microsoft announced Project Scarlett, the successor to the Xbox One, at E3 2019. The company said that the new console will be 4 times as powerful as the Xbox One and is slated for a release date of Christmas 2020 Getty Gadget and tech news: In pictures First new iPod in four years Apple has announced the new iPod Touch, the first new iPod in four years. The device will have the option of adding more storage, up to 256GB Apple Gadget and tech news: In pictures Folding phone may flop Samsung will cancel orders of its Galaxy Fold phone at the end of May if the phone is not then ready for sale. The $2000 folding phone has been found to break easily with review copies being recalled after backlash PA Gadget and tech news: In pictures Charging mat non-starter Apple has cancelled its AirPower wireless charging mat, which was slated as a way to charge numerous apple products at once AFP/Getty Gadget and tech news: In pictures "Super league" India shoots down satellite India has claimed status as part of a "super league" of nations after shooting down a live satellite in a test of new missile technology EPA Gadget and tech news: In pictures 5G incoming 5G wireless internet is expected to launch in 2019, with the potential to reach speeds of 50mb/s Getty Gadget and tech news: In pictures Uber halts driverless testing after death Uber has halted testing of driverless vehicles after a woman was killed by one of their cars in Tempe, Arizona. March 19 2018 Getty Gadget and tech news: In pictures A humanoid robot gestures during a demo at a stall in the Indian Machine Tools Expo, IMTEX/Tooltech 2017 held in Bangalore Getty Gadget and tech news: In pictures A humanoid robot gestures during a demo at a stall in the Indian Machine Tools Expo, IMTEX/Tooltech 2017 held in Bangalore Getty Gadget and tech news: In pictures Engineers test a four-metre-tall humanoid manned robot dubbed Method-2 in a lab of the Hankook Mirae Technology in Gunpo, south of Seoul, South Korea Jung Yeon-Je/AFP/Getty Gadget and tech news: In pictures Engineers test a four-metre-tall humanoid manned robot dubbed Method-2 in a lab of the Hankook Mirae Technology in Gunpo, south of Seoul, South Korea Jung Yeon-Je/AFP/Getty Gadget and tech news: In pictures The giant human-like robot bears a striking resemblance to the military robots starring in the movie 'Avatar' and is claimed as a world first by its creators from a South Korean robotic company Jung Yeon-Je/AFP/Getty Gadget and tech news: In pictures Engineers test a four-metre-tall humanoid manned robot dubbed Method-2 in a lab of the Hankook Mirae Technology in Gunpo, south of Seoul, South Korea Jung Yeon-Je/AFP/Getty Gadget and tech news: In pictures Waseda University's saxophonist robot WAS-5, developed by professor Atsuo Takanishi Rex Gadget and tech news: In pictures Waseda University's saxophonist robot WAS-5, developed by professor Atsuo Takanishi and Kaptain Rock playing one string light saber guitar perform jam session Rex Gadget and tech news: In pictures A test line of a new energy suspension railway resembling the giant panda is seen in Chengdu, Sichuan Province, China Reuters Gadget and tech news: In pictures A test line of a new energy suspension railway, resembling a giant panda, is seen in Chengdu, Sichuan Province, China Reuters Gadget and tech news: In pictures A concept car by Trumpchi from GAC Group is shown at the International Automobile Exhibition in Guangzhou, China Rex Gadget and tech news: In pictures A Mirai fuel cell vehicle by Toyota is displayed at the International Automobile Exhibition in Guangzhou, China Reuters Gadget and tech news: In pictures A visitor tries a Nissan VR experience at the International Automobile Exhibition in Guangzhou, China Reuters Gadget and tech news: In pictures A man looks at an exhibit entitled 'Mimus' a giant industrial robot which has been reprogrammed to interact with humans during a photocall at the new Design Museum in South Kensington, London Getty Gadget and tech news: In pictures A new Israeli Da-Vinci unmanned aerial vehicle manufactured by Elbit Systems is displayed during the 4th International conference on Home Land Security and Cyber in the Israeli coastal city of Tel Aviv Getty

A message showing on computers tells users that they can recover files but only if they send $300 of bitcoin to a specific address.

The price will rise with time and the files will eventually be deleted, the warning reads.

Affected NHS trusts said that IT systems had been shut down in order to protect them. That meant that all systems were offline and hospitals were unable to accept incoming calls.

Scheduled appointments had to be cancelled, ambulances were diverted and some departments shut down entirely. What staff were working had to do so with pen and paper and without access to any digital files.

Leaders including Theresa May and Nicola Sturgeon held crisis meetings on the issue to attempt to stem the effects.

The attack appeared to be a new strain of a relatively well-known piece of ransomware known as Wanna Decryptor. That was updated on the day of the attack and spread around the world soon after, according to security experts.

A conversation circulating online saw one doctor saying "our hospital is down".

"We got a message saying your computers are now under their control and pay a certain amount of money," the messages read. "And now everything is gone.”

The NHS has been hit by such attacks before. But this was by far the worst, experts said, taking down an unprecedented number of trusts and hospitals.

It came soon after a report was published in the British Medical Journal in which neurologist Dr Krishna Chinthapalli warned hospitals that they were at risk of an attack.

"We should be prepared: more hospitals will almost certainly be shut down by ransomware this year," he wrote.

He warned just hours before the hack broke out that IT departments needed to do more to keep hospitals safe, and that such hacks – which have already hit some hospitals in the US – were a problem waiting to happen.

However, the new attack was the worst ever seen, he said.

"I've never heard about a ransomware attack being so widespread - affecting so many hospitals across such a wide area," he said.

"There have been many isolated attacks but this is the first to be so coordinated - a number of attacks in different parts of the country.

"We have not seen this either here or in other countries - such as America."

NHS trusts also were asking people not to come to A&E, but instead to ring 111, or 999 in the case of an emergency.

“To ensure that all back-up processes and procedures were put in place quickly, the trust declared a major internal incident to make sure that patients already in the trust’s hospitals continued to receive the care they need," a spokesperson for East and North Hertfordshire NHS trust said.

Other trusts stressed that some of the problems were being caused by protective measures, rather than the cyber attack itself.

"Following a suspected national cyber attack we are taking all precautionary measures possible to protect our local NHS systems and services," NHS Merseyside said on Twitter.

NHS Blackpool Clinical Commissioning Group tweeted: "We are aware of an IT issue affecting some GP computer systems.

"Patients are asked for understanding whilst the issue is resolved.

A woman points to the website of the NHS: East and North Hertfordshire notifying users of a problem in its network (AFP)

"Please avoid contacting your GP practice unless absolutely necessary. Should you wish to obtain non-urgent medical advice, please call 111.

"Please also only attend the Walk-In Centre and A&E department if absolutely necessary."

A spokesman for NHS England said there was "an issue with IT", but referred further inquiries to NHS Digital, which did not immediately comment.

Prime Minister Theresa May said the hit on the NHS was part of a wider attack and said there was no evidence that patient data had been compromised.

"This is not targeted at the NHS, it's an international attack and a number of countries and organisations have been affected," she said.

"The National Cyber Security Centre is working closely with NHS digital to ensure that they support the organisations concerned and that they protect patient safety.

"And, we are not aware of any evidence that patient data has been compromised.

"Of course it is important that we have set up the National Cyber Security Centre and they are able to work with the NHS organisations concerned and to ensure that they are supported and patient safety is protected."

But shadow health secretary John Ashworth said the attack was a "real worry for patients".

"Our hard-working NHS staff are already operating under unprecedented pressure and should be given every support to help the public in the face of these malicious and disturbing actions," he said.

"This incident highlights the risk to data security within the modern health service and reinforces the need for cyber security to be at the heart of government planning. The digital revolution has transformed the way we live and work but we have to be ready for the vulnerabilities it brings too.

"The Government needto be clear about what's happened and what measures they are taking to reduce the threat to patients."

The Patients' Association condemned the criminals behind the cyber attack on the NHS but said lessons from earlier incidents had not been learned.

In a statement the group said: "We should be clear that responsibility for today's apparently extensive attack on NHS IT systems, and for any harm that occurs to patients as a result, lies with the criminals who have perpetrated it.

"From reports so far, the attack appears to have been highly coordinated and aggressive and a police investigation will no doubt be required.

"However, that something of this sort could happen will surprise few people.

The instruction file that Nurse Helen Barrow, of Littleborough, Lancashire, found on her desktop after becoming the first known UK victim (PA)

"It has long been known that the NHS struggles with IT in multiple respects and that this includes serious security problems.

"Though today's may be the largest attack of this sort, it is not the first - yet the lessons from earlier incidents have not been learnt.

It comes months after Barts Health Trust, the largest NHS trust in England, was hit by a ransomware cyber attack.

The problems were widespread across the world, with the Wanna Decryptor malware spreading itself across the internet.

"This cyber attack is much larger than just the NHS," said Travis Farral, director of security strategy for cyber security firm Anomali Labs. "It appears to be a giant campaign that has hit Spain and Russia the hardest."

Some people are already paying to get their files back, Mr Farral said.

Wanna Decryptor, the malware that is being used, has been known to cyber security experts for weeks. But the version spreading across the internet has just been updated, according to reports.

"The ransomware used in this attack is relatively new - it was first seen in February 2017, and the latest variant emerged earlier today," said Aatish Pattni from cyber security firm Check Point.

"Even so, it's spreading fast, with organisations across Europe and Asia being hit.

"It shows just how damaging ransomware can be - and how quickly it can cause disruption to vital services.

"Organisations need to be able to prevent infections taking hold in the first place, by scanning for, blocking and filtering out suspicious files content before it reaches their networks.