Parliament has been hit by a cyber attack, officials at Westminster say.

The “sustained” hack began on Friday night, prompting officials to disable remote access to the emails of MPs, peers and their staff as a safeguard.

The parliamentary authorities said hackers had mounted a “determined attack” on all user accounts “in an attempt to identify weak passwords”.

Government sources say it appeared the attack has been contained but it will “remain vigilant”.

A parliamentary spokeswoman said they were investigating the attack and liaising with the National Cyber Security Centre.

She said: “We have discovered unauthorised attempts to access accounts of parliamentary networks users…

“Parliament has robust measures in place to protect all of our accounts and systems, and we are taking the necessary steps to protect and secure our network.

“As a precaution we have temporarily restricted remote access to the network.”

IT services on the parliamentary estate are working normally and a message sent to MPs urges them to be “extra vigilant”.

But a number of MPs have confirmed to the BBC they are not able to access their parliamentary email accounts outside of the Westminster estate.

It comes just over a month after 48 of England’s NHS trusts were hit by a cyber-attack.

International Trade Secretary Liam Fox said: “We have seen reports in the last few days of even Cabinet ministers’ passwords being for sale online.

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

“And it’s a warning to everybody, whether they are in Parliament or elsewhere, that they need to do everything possible to maintain their own cyber security.”

The latest attack was publicly revealed by Liberal Democrat peer Lord Rennard on Twitter as he asked his followers to send any “urgent messages” to him by text.

Henry Smith, Tory MP for Crawley, later tweeted: “Sorry no parliamentary email access today – we’re under cyber attack from Kim Jong Un, (Vladimir) Putin or a kid in his mom’s basement or something…”

The government’s National Security Strategy said in 2015 that the threat from cyber-attacks from both organised crime and foreign intelligence agencies was one of the “most significant risks to UK interests”.

The National Cyber Security Centre, which is part of intelligence agency GCHQ, started its operations in October last year.

The National Crime Agency said it was working with the NCSC but the centre was “leading the operational response”.