Canada's top court agreed on Thursday to weigh in on a case in which the ability of journalists to do their work conflicts with the ability of police and prosecutors to do theirs.

The Supreme Court of Canada decision to grant Vice Media leave to appeal follows a ruling by Ontario's highest court that reporter Ben Makuch turn over background materials to the RCMP related to interviews he did with a suspected terrorist.

"Oh, man, very relieved," Makuch said moments after learning of the leave decision. "This is an extremely important matter that our country's highest court needs to hear."

The materials at issue relate to three stories Makuch wrote in 2014 on a Calgary man, Farah Shirdon, 22, charged in absentia with various terrorism-related offences. The articles were largely based on conversations Makuch had with Shirdon, who was said to be in Iraq, via the online instant messaging app Kik Messenger.

With court permission, RCMP sought access to Makuch's screen captures and logs of those chats. Makuch refused to hand them over.

RCMP and the Crown argued successfully at two levels of court that access to the chat logs were essential to the ongoing investigation into Shirdon, who may or may not be dead. They maintained that journalists have no special rights to withhold crucial information.

Backed by alarmed media and free-expression groups, Makuch and Vice Media argued unsuccessfully that the RCMP demand would put a damper on the willingness of sources to speak to journalists.

The conflicting views will now be tested before the Supreme Court.

Unclear if Shirdon is alive or dead

In his initial ruling, Superior Court Justice Ian MacDonnell said the screen shots were important evidence in relation to "very serious allegations." MacDonnell also said the public had a strong interest in the effective investigation and prosecution of such allegations.

The Ontario Court of Appeal agreed, rejecting Vice's arguments that the prosecution should have to prove the requested information is essential to the RCMP case. It also said MacDonnell had been aware of the potential "chill" effect — that sources may not be willing to speak to reporters if they risk exposure.

Chris Ball, a spokesman for Vice said the outlet was "thrilled" by the willingness of the Supreme Court to get involved.

"This has been a long battle so far, not only for our journalist Ben Makuch, but for all journalists and protecting their ability to do their jobs without fear of interference by the state," Ball said.

The legal battle has been playing out against a backdrop of uncertainty as to whether Shirdon is dead or alive. American military officials said over the summer that Shirdon was killed more than two years ago. The statement came just months after the U.S. State Department listed him as a designated terrorist, suggesting he was still alive.

Efforts by The Canadian Press to clear up the confusion foundered when the military stood by its position and the State Department referred queries to the "intelligence community," and then pointed to the U.S. National Counterterrorism Centre, which did not respond.

Vice said recently it would drop the appeal if the RCMP dropped its production order given Shirdon's reported death. RCMP and prosecution, however, citing the confusion, refused.

Makuch, who has said he published all information relevant to the public, said Thursday the ongoing battle has not been easy.

"This has taken a personal toll on me," Makuch said. "This isn't over. I have to keep on fighting this for not just myself, but for other journalists in this country."

Members of a coalition that supported Makuch, including Canadian Journalists for Free Expression, Reporters Without Borders and News Media Canada, have condemned the lower courts for failing to recognize the importance of journalistic source protection.