OTTAWA -- A Vice Media reporter must give the RCMP material he gathered for stories about an accused terrorist, the Supreme Court of Canada has ruled in a case that pitted press freedoms against the investigative powers of police.

In its 9-0 decision Friday, the high court said the state's interest in prosecuting crime outweighed the media's right to privacy in gathering the news when all the factors in play were taken into account.

Vice Media said the ruling made it a "dark day for press freedom."

Organizations representing Canadian journalists also decried the decision as a setback that imperils their work.

"Police have an important job to do in protecting us from crime, but they cannot expect journalists to do that job for them," said Martin O'Hanlon, president of CWA Canada, a union that represents over 6,000 media workers. "The media is not, nor should it ever be, an arm of the state."

In 2014, reporter Ben Makuch wrote three articles about the involvement of Farah Mohamed Shirdon, formerly of Calgary, with the Islamic State of Iraq and the Levant.

Shirdon had left Canada for Turkey in March of that year. A month later, he appeared in an ISIL propaganda video that turned up on the internet. He tore up his Canadian passport, threw it into a fire and said, "With help from Allah, we are coming to slaughter you."

Exchanges between Makuch and Shirdon through a text-messaging service were crucial to the articles.

In 2015, the RCMP obtained a production order under the Criminal Code, directing Vice Media and Makuch to provide documents and data relating to communications with Shirdon, who might now be dead.

Makuch brought an application to quash the production order, but it was dismissed -- a decision upheld by the Ontario Court of Appeal.

The Supreme Court agreed to examine Makuch's case, with a full bench hearing arguments last May.

In a previous case, the court had set out nine conditions for assessing the reasonableness of a search of a media outlet.

Vice Media argued at the Supreme Court that lower courts had been incorrectly applying, or failing to apply, that balancing test.

Philip Tunley, a lawyer for the multimedia outlet, told the high court there should be clear protections for journalists when enforcement agencies come knocking.

He said the result of current law and practice was "a chilling effect" on the media's important role in gathering and publishing news in Canada.

Federal lawyer Croft Michaelson told the hearing there was "no merit" to criticisms of the legal framework in place for deciding on police access to media materials.

In its arguments, the Crown called the test a principled and flexible framework intended to curb any potential chilling effect that an order might have on the ability of the media to do its work.

Although the Supreme Court was unanimous in dismissing Makuch's appeal, the judges provided two distinct sets of reasons.

Justice Michael Moldaver said on behalf of the majority that the framework continues to provide a suitable model for considering applications for search warrants and production orders relating to the media, though certain elements should be tweaked.

Even then, Moldaver wrote, the production order for Makuch's materials should stand because disclosure of the materials would not reveal a confidential source, no "off the record" or "not for attribution" communications would be disclosed, there is no alternative source through which the materials could be obtained, and Shirdon used the media to publicize extremist views.

Moldaver added that he struggled to see why a chilling effect should be presumed in such matters, saying this "should be assessed on a case-by-case basis."

Tunley had no comment Friday, and it was not clear when -- or even if -- the materials would be given to the RCMP.

The Mounties said they respect the judicial process but would not comment on the next steps in their investigation.

"This is a dark day for press freedom, which is a basic tenet of democracy," Vice Media said in a statement. "While we've lost this battle, nothing can shake our belief that a free press is instrumental to a truthful understanding of the world in which we live."

Makuch, who is based in New York, was not at the court for the decision's release, but he tweeted: "I am profoundly disappointed in today's ruling, not just as an appellant in this case or a reporter, but as a citizen of Canada."

The Canadian Association of Journalists and Canadian Journalists for Free Expression also called the ruling deeply disappointing.

"It creates a chill for anyone who wants to speak truth to power or expose government wrongdoing," said CAJ president and CJFE board member Karyn Pugliese. "The country's highest court erred significantly in today's decision."