Media playback is unsupported on your device Media caption David Davis: "The government declared a bogus emergency'' to push the legislation through

The High Court is hearing a legal challenge to the government's emergency surveillance law, brought by two MPs.

The Data Retention and Investigatory Powers Act was fast-tracked through Parliament in three days last July.

It allows Britain's intelligence agencies to gather people's phone and internet communications data.

But former Conservative minister David Davis and Labour's Tom Watson will argue that the legislation is incompatible with human rights.

Individuals or organisations have the power to seek a judicial review of any decision by a public body that they believe has been made unlawfully.

Follow all the day's political developments live

The Data Retention and Investigatory Powers Act was rushed through Parliament in July 2014, after a ruling by the European Union's Court of Justice rendered existing powers illegal.

A bill's passage through the Commons usually takes a matter of weeks or months but there are well-established procedures for fast-tracking legislation when MPs believe it is necessary to do so.

The government said at the time that without the new law the UK's ability to fight crime and protect the country against terrorism would be seriously impeded.

Image copyright Thinkstock Image caption New measures are being drawn up by the government to "address gaps" in intelligence gathering

Ministers said the act would simply maintain existing powers, which required communications companies to retain data for 12 months for possible investigation.

They said it would not allow police or security agencies to access the content of calls or emails without a warrant.

The plans were supported by the three main parties, but opposed by civil liberties campaigners.

'Powerless'

However, Mr Watson and Mr Davis say the legislation was rushed and lacked adequate safeguards, and needs to be re-thought.

They argue that the legislation is incompatible with the right to a private and family life, and data protection, under both the Human Rights Act and the European Union Charter of Fundamental Rights.

The MPs aim is to get the legislation sent back to Parliament for further consideration, under the terms of the Human Rights Act, or struck down under the terms of the European charter.

The legislation relates to the harvesting and retention of data only - the power to access stored data is governed by separate laws.

Mr Watson said in a statement: "The government's decision to use emergency powers to enable it to spy on citizens shows the rights of the individual need to be strengthened to ensure the state can't act with impunity.

"Even MPs are powerless to prevent such powers being enacted.

Media playback is unsupported on your device Media caption Tom Watson MP: ''This legalisation was rushed through in three days flat''

"The Human Rights Act allows us to challenge those powers in the courts but the Tory government is intent on tearing up the Act and doing away with the limited legal protection it affords.

"It is vital that we fight for it to be retained."

Mr Davis, who has also criticised the government's intention to scrap the Human Rights Act and replace it with a British Bill of Rights, said: "This Act of Parliament was driven through the House of Commons with ridiculous and unnecessary haste to meet a completely artificial emergency."

'Lives at risk'

Emma Norton, a legal officer for campaign group Liberty, which is bringing the case on behalf of the two MPs, said: "People need to understand just how personal this information is that will be taken and retained and what an intimate portrait of their lives it will create.

"And there was very little evidence to suggest that by giving police even greater banks of information about people who they don't even suspect of committing crimes it is going to make their jobs easier - it isn't."

The Home Office said it does not comment on on-going legal proceedings. The High Court hearing is expected to last two days but the verdict is not expected for some months.

The MPs' legal challenge comes as Home Secretary Theresa May draws up proposals to give police and spies new powers to monitor internet and phone use.

Downing Street said the measures, announced in last month's Queen's Speech, would "address gaps" in intelligence gathering and access to communications data that are putting "lives at risk".

However, civil liberties campaigners claim they will pave the way for mass surveillance of UK citizens.

Mrs May's efforts to introduce a similar bill in 2012, dubbed the "snooper's charter" by critics, were blocked by their coalition partners, the Liberal Democrats.