Ministers have been ordered to justify GCHQ's mass surveillance programmes by judges at the European court of human rights who have fast-tracked a case brought by privacy and human rights campaigners.

The court in Strasbourg has told the government to provide submissions by the beginning of May about whether GCHQ's spying activities could be a violation of the right to privacy under article 8 of the European convention.

Marking the case a priority, campaigners are hopeful the court will bring a ruling before the end of the year.

The case was brought last September by Big Brother Watch, the Open Rights Group and English PEN, along with the German internet activist Constanze Kurz.

It followed the Guardian's revelations about GCHQ's data-trawling techniques which were detailed in papers leaked by the whistleblower Edward Snowden. The groups claim that by collecting data on millions of people not under any suspicion GCHQ has infringed the privacy of British and European citizens.

In a series of questions, the court has asked British ministers to explain why they think Britain's intelligence services have the right to solicit, receive, search, analyse, disseminate and store data intercepted by themselves, or by foreign spy agencies. The court says the UK needs to show this activity is "within the law" and "necessary in a democratic society".

The case refers specifically to two surveillance programmes, Prism and Tempora. Between them, they allow GCHQ and its US counterpart, the National Security Agency to harvest, store and analyse data from millions of phone calls, emails and search engine queries.

In the complaint to the court, the groups argued much of this activity is not underpinned by British law. They said there was no "effective, independent authorisation and oversight" of the programmes. The claim states: "The interception of external communications by GCHQ is an inherently disproportionate interference with the private lives of thousands, perhaps millions of people."

"The European court of human rights has acted remarkably quickly in communicating the case to the government and designating it as a priority," said Daniel Carey, the lawyer acting for the groups.

"It has also acted decisively by requiring the government to explain how the UK's surveillance practices and oversight mechanisms comply with the right to privacy. This gives hope the ECHR will require reform if the government continues to insist that nothing is wrong."

Nick Pickles of Big Brother Watch said: "This legal challenge is an essential part of getting to the bottom of why the public and parliament have not been properly informed about the scale of surveillance and why our privacy has been subverted on an industrial scale."

GCHQ and ministers have consistently denied that any of the programmes revealed by Snowden breach the law.

GCHQ maintains its work "is carried out in accordance with a strict legal and policy framework which ensures that our activities are authorised, necessary and proportionate, and that there is rigorous oversight, including from the secretary of state, the Interception and Intelligence Services commissioners and the parliamentary intelligence and security committee".

William Hague, the foreign secretary, has also defended Britain's intelligence agencies, saying law-biding members of the public have "nothing to fear".

"If we could tell the whole world and the whole country how we do this business, I think people would be enormously reassured by it and they would see that the law-abiding citizen has nothing to worry about.

"This is secret work, it is secret intelligence, it is secret for a reason, and a reason that is to do with protecting all the people of this country."

However, Jim Killock, executive director of the Open Rights Group, said it was now clear that British laws had been abused to give the agencies a chance "to monitor everything and everyone almost constantly".