Image copyright Getty Images Image caption Communications services can be told to collect metadata

Powers used by the security services to "Hoover up" communications data from most people in the UK, even those not suspected of an offence, are "too wide" and invade privacy, a court has heard.

Civil rights group Liberty is challenging the government at the High Court over how the Investigatory Powers Act (IPA) - dubbed the "snoopers' charter" by critics - is being used.

It says it is incompatible with the European Convention on Human Rights.

The government denies the claim.

Liberty's lawyers say that "bulk" 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

which apps they have downloaded to their phone

their usernames and passwords

and even cell site data that can pin-point a person's location at a given time

Even if a warrant has been granted for the data to be gathered, they argue, the searching of bulk data - sometimes known as secondary data - is not governed by any warrant.

They also say the data can still be searched even if the warrant, that allowed for it to be seized in the first place, has expired.

Liberty's barrister Martin Chamberlain QC told the court: "These powers permit the interception or obtaining, processing, retention and examination of the private information of very large numbers of people - in some cases, the whole population.

"They also permit serious invasions of journalistic and watchdog organisations' materials and lawyer-client communication."

Last week, in a preliminary hearing, it emerged that the storage and handling of large amounts of data gathered by the security service MI5 is "undoubtedly unlawful" according to the government watchdog - the investigatory powers commissioner.

Safeguards over the storage, retention and deletion of data were not being adhered to by the domestic security service the watchdog said in a ruling.

In court, the lawyers for Liberty maintained that the government's oversight of the operation of the IPA was inadequate in the way it failed to properly supervise the interception of communications data - who sent what to who and when - and the way in which that data can be subsequently searched.

The court action has been joined by the National Union of Journalists which says the current regime for data interception does not adequately safeguard journalists from interference from the state.

Image copyright PA Image caption MI5 headquarters in London

Government lawyers are expected to argue the gathering of massive amounts of private data - in what has been compared to a "soup" of information - does not pose any meaningful risk of an invasion of privacy because the vast majority of it will never be examined by investigators.

Sir James Eadie QC, representing Home Secretary Sajid Javid and Foreign Secretary Jeremy Hunt, submitted that the powers provided by the act "strike an appropriate balance between security and individual privacy".

He added that there was "a variety of strong safeguards" built into the act to protect journalistic material.

The trial is expected to last all week.