Image copyright Getty Images Image caption A lawyer with Liberty called the ruling "disappointing"

Human rights group Liberty has lost its High Court challenge against the government's Investigatory Powers Act.

Called the "Snoopers' Charter" by its critics, the legislation allows for mass surveillance of electronic devices, allowing intelligence agencies to extract and store information.

Liberty claimed the powers of "bulk hacking" were unlawfully wide.

But Lord Justice Singh and Mr Justice Holgate told the High Court on Monday the surveillance powers were lawful.

A lawyer with Liberty said the group will appeal against the ruling.

The case was brought to court following criticism of the way MI5 handled its data storage operations.

Liberty's lawyers said the data gathered by the security services and other agencies - under warrants granted by a judge or the home secretary - can include:

Intimate data, including an individual's internet browsing history

The apps users have downloaded to their phone

Usernames and passwords

Cell site data that can pin-point a person's location at a given time

The group said warrants did not cover collecting data in bulk, meaning it breached human rights law, and the data would be kept on file for searching after any warrant had expired.

The case was also supported by the National Union of Journalists (NUJ), which argued there were insufficient safeguards to protect confidential journalistic sources.

But the judges dismissed Liberty's claim, ruling that "the totality of the suite of interlocking safeguards" meant the Act was sound.

Their ruling said: "We have reached the conclusion that the safeguards in [IPA] are sufficient to prevent the risk of abuse of discretionary power and the Act is therefore not incompatible with the [European Convention on Human Rights] on the ground that it does not comply with the concept of law."

Sir James Eadie QC, representing the then home secretary, Sajid Javid, and then foreign secretary, Jeremy Hunt, submitted that the powers provided by IPA "strike an appropriate balance between security and individual privacy", and were of "critical importance to, and are effective in securing, the protection of the public".

'Keep fighting'

Megan Goulding, a lawyer with Liberty, said: "This disappointing judgment allows the government to continue to spy on every one of us, violating our rights to privacy and free expression.

"We will challenge this judgment in the courts, and keep fighting for a targeted surveillance regime that respects our rights."

"These bulk surveillance powers allow the state to Hoover up the messages, calls and web history of hordes of ordinary people who are not suspected of any wrongdoing."

Michelle Stanistreet, general secretary of the NUJ said the judgement was "a blow to journalists and press freedom".

However, the judges ruled that the IPA did not breach journalists freedom of expression "in so far as it is suggested that there are inadequate protections for journalistic material".

Responding to the judgement, security minister Brandon Lewis said IPA introduced "a series of world-leading protections to ensure powers were only used where necessary and proportionate to keep us all safe".

"The court has ruled today that, thanks to the rigorous oversight and safeguards we have in place, we have created a lawful regime that keeps the public safe and protects their right to privacy," he added.