Image copyright Courtesy Vice Media Image caption Ben Makuch

Canada's top court has ruled that Vice Media must hand over its communications with a suspected terrorist to police.

The Supreme Court says that a Royal Canadian Mounted Police's production order seeking those communications "was properly issued and should be upheld".

Vice Media has refused to hand those notes over.

The critical case dealt with questions of how a democracy balances public safety with the protected freedom of the press.

On Friday, in a unanimous decision, the Supreme Court came down on the side of the RCMP, saying the force's order strikes "a proportionate balance" between the rights of the press to gather information without undue interference from government and the needs of police to investigate serious crimes.

Ben Makuch, a national security journalist with Vice News, made contact with Canadian citizen Farah Shirdon in 2014.

He is believed to have left his home in the city of Calgary in March of that year to join the Islamic State group, one of many young westerners who travelled to Iraq and Syria to join IS.

Mr Makuch eventually published three articles about his conversations with Mr Shirdon, articles which embroiled the journalist in the lengthy legal battle with Canada's federal police force.

Image copyright Toronto Star via Getty Images Image caption The Supreme Court of Canada

Following their publication, the RCMP came seeking access to all communications Vice had with Mr Shirdon as part of their criminal investigation into the terror suspect. Mr Shirdon has been charged in absentia with six terrorism offences.

Mr Shirdon is believed to be have been killed.

Vice went to court to appeal against the production order, arguing that handing over the text could have a "chilling effect" on sources.

Two lower courts have previously upheld the RCMP production order.

Mr Makuch received the support of numerous press freedom organisations, including Reporters Without Borders, during the legal battle.

The Supreme Court said on Friday that Vice's argument that handing over the texts would interfere with its newsgathering "shrivels in a context where the source was not a confidential one and wanted everything he said to be made public", the court said.

"Crucially, there is no suggestion that anything the source said was intended or understood to be 'off the record'."

It said: "Accordingly, the benefit of the state's interest in obtaining the messages outweighs any harm to Vice Media's rights".

Vice Media said in a statement that "this is a dark day for press freedom, which is a basic tenet of democracy".

CWA Canada, a media union whose members include Vice Media journalists, said in a statement that it is "troubled" by the ruling.

"Police have an important job to do in protecting us from crime, but they cannot expect journalists to do that job for them," it said.