LONDON (Reuters) - Senior British politicians, including both contenders to be the next prime minister, joined journalists on Saturday in criticizing police for warning media not to publish leaked government documents, saying it was a “dangerous road to tread”.

Last week, a Sunday newspaper published leaked memos from Britain’s Washington ambassador that provoked a serious diplomatic spat with U.S. President Donald Trump and ultimately led to the envoy announcing his resignation.

Britain’s most senior counter-terrorism officer, Neil Basu, said on Friday police would investigate who was responsible but also warned journalists and publishers they too could be in breach of the law if further documents were leaked.

His comments provoked anger and criticism from journalists, editors and politicians who said it risked infringing the freedom of the press.

The Society of Editors described it as a heavy-handed approach that would be expected from totalitarian regimes and George Osborne, editor of the London Evening Standard and a former finance minister, called it a “very stupid and ill-advised statement from a junior officer who doesn’t appear to understand much about press freedom”.

“The state threatening media freedom is a dangerous road to tread,” Health Minister Matt Hancock said on Twitter.

Basu issued a further statement on Saturday, stating that the police respected media rights but reiterating the message that there should be no further publication of the leaked documents and others which he said remained in circulation.

“The focus of the investigation is clearly on identifying who was responsible for the leak,” Basu said.

“However, we have also been told the publication of these specific documents, now knowing they may be a breach of the OSA (Official Secrets Act), could also constitute a criminal offense and one that carries no public interest defense.”

FILE PHOTO: Assistant Commissioner of the Metropolitan Police Neil Basu speaks to the media after a car crashed outside the Houses of Parliament in Westminster, London, Britain, August 14, 2018. REUTERS/Hannah McKay

Both men battling to replace Theresa May as prime minister when she steps down on July 24 because she failed to deliver Britain’s exit from the European Union, had earlier said the warning from Basu was wrong.

“THAT IS THEIR JOB”

“It cannot be conceivably right that newspapers or any other media organization publishing such material should face prosecution,” former London Mayor Johnson told an event in central England.

Foreign Secretary Jeremy Hunt wrote on Twitter: “I defend to the hilt the right of the press to publish those leaks if they receive them & judge them to be in the public interest: that is their job.”

Both said the leaker should be found but the press should not be targeted.

The Mail on Sunday newspaper last week published cables from Kim Darroch, Britain’s ambassador to the United States, in which he called the Trump administration “inept”, prompting the president to label him “very stupid” and “wacky”.

The spat has become one of the central issues of the contest for the leadership of the governing Conservative Party and the next prime minister that will be decided by about 160,000 members of the Conservative Party. A diplomatic source told Reuters that the lack of backing from the frontrunner, Boris Johnson, had been a factor in Darroch’s decision to resign.

Johnson himself acknowledged his comments had been partly responsible but denied he was to blame.

Not all politicians, though, felt the police were wrong. Security minister Ben Wallace said members of the public were bound by parts of the Official Secrets Act.

“If (journalists) are receiving stolen material they should give it back to their rightful owner and they should also be aware of the huge damage that’s already been done and the potentially even greater damage that could be done,” former defense minister Michael Fallon told BBC radio.