Britain's Parliament was hit by a "sustained and determined" cyber attack on Saturday designed to identify weak email passwords, just over a month after a ransomware worm crippled parts of the country's health service.

The House of Commons said it was working with the National Cyber Security Centre to defend parliament's network and was confident it had protected all accounts and systems.

"Earlier this morning we discovered unusual activity and evidence of an attempted cyber-attack on our computer network," an email sent by parliamentary authorities to those people affected said.

"Closer investigation by our team confirmed that hackers were carrying out a sustained and determined attack on all parliamentary user accounts in an attempt to identify weak passwords."

Britain's National Health Service was hit by a massive global ransomware worm in May which crippled the computer system and forced some hospitals to turn away patients.

The National Cyber Security centre is part of Britain's GCHQ spy agency, set up last year to tackle what the government believes is one of the biggest threats to British security.

Chris Rennard, a member of the Liberal Democrat party in the upper House of Lords, was the first to draw attention to the problem, using Twitter to announce: "Cyber security attack on Westminster, Parliamentary emails may not work remotely, Text urgent messages."

Cyber security attack on Westminster Parliamentary e.mails may not work remotely Text urgent messages <a href="https://twitter.com/LibDemLords">@LibDemLords</a> <a href="https://twitter.com/LabourLordsUK">@LabourLordsUK</a> <a href="https://twitter.com/Torypeers">@Torypeers</a> —@LordRennard

A spokeswoman for the House of Commons confirmed that unauthorised attempts had been made to access parliamentary accounts and said systems were in place to protect member and staff details.

"As a precaution we have temporarily restricted remote access to the network," she said. "As a result, some Members of Parliament and staff cannot access their email accounts outside of Westminster."

Liam Fox, the minister for international trade, said the attack was not a surprise and should act as a warning to people across the country to the threat posed by cyber hackers.

"We've seen reports in the last few days of even cabinet ministers' passwords being for sale online," he told broadcasters.

"We know that our public services are attacked so it's not at all surprising that there should be an attempt to hack into parliamentary emails."