Image copyright Thinkstock Image caption Police in the case wanted access to information including phone call data, the court heard

A judge has granted police permission to access journalists' phone records for the first time in a public hearing.

Officers from Operation Elveden, the investigation into alleged corrupt payments to public officials, had made the request at the Old Bailey.

A temporary change in the law means officers must now go before a judge if they are seeking to obtain such communications data.

It came after criticism of the way police accessed journalists' sources.

Previously, police had used the Regulation of Investigatory Powers Act (Ripa) to seek information about phone records.

The Home Office said the move, introduced in February, was an "interim solution" ahead of the next parliament.

It was recommended by an official review into Ripa, launched after concerns were raised about incidents such as Scotland Yard accessing the phone records of Sun reporter Tom Newton Dunn to find who had leaked information on the so-called Plebgate row.

'Public interest'

Jeremy Johnson QC, representing the Metropolitan Police, appeared before Mr Justice Sweeney at the London court to request access to information involving two journalists and two public officials, who cannot be named for legal reasons.

Mr Johnson said that breaching the individuals' privacy was justified as it was in the "public interest".

He argued there were "reasonable grounds" to believe a crime had been committed and that the information would be of "substantial" value to the investigation.

The Met officers asked for access to phone call data, including subscriber information and bill records, which involved serving notice to the phone service provider as well as to the journalists, the court heard.

Following lengthy legal argument on Friday, Mr Justice Sweeney approved the police applications on Tuesday.

As the Elveden request was the first to fall under the new rules, the judge said he had made an "exception" for it to be heard in open court rather than in private.

Arguing that he was not intending to set a precedent, Mr Justice Sweeney added: "Normally applications would be held in private but given they are the first of their type and following the interception commissioner report on the change of approach to applications of this type...it seemed to me exceptional and subject to submissions it would be appropriate for them to be held in open court."

Operation Elveden has cost £12.4m to date and has brought about the conviction of 21 public officials.

Twenty seven journalists have also been prosecuted, but only one prosecution has been successful.

Ex-News of the World journalist Dan Evans pleaded guilty to phone hacking and making illegal payments to officials and was given a suspended sentence in July 2014.