Image copyright Courtesy Vice Media Image caption Ben Makuch

The refusal of a journalist to hand over communications with a terror suspect has raised fundamental questions about press freedoms and national security.

Just a year after the Islamic State group was formed in 2013, it was already building a reputation as one of the most dangerous jihadist organisations in the world.

IS appeared unstoppable as it seized swaths of Iraqi territory, and as large numbers of foreign fighters flocked to region to join the group.

The jihadist group and its acolytes captured the interest of Ben Makuch, a national security journalist with Vice News in Canada, who had watched terrorism shape contemporary geopolitics since the Twin Towers fell on 9/11 when he was 12.

"I started noticing these guys who were my age who were on all the same social media application that I use and not only that, it looked real," he says.

"These guys were in Raqqa, in Mosul, in the caliphate."

The 29-year-old reporter began following some of them online, and eventually made contact with Somali-Canadian Farah Shirdon, who had made headlines for appearing in a YouTube video burning his passport and threatening the US and Canada.

Image copyright RCMP handout Image caption Farah Shirdon is believed to have left Canada in March 2014

Makuch said he couldn't turn down the opportunity to "have a conversation with these types of individuals, let alone one from your own country, talking about why he went over, why he left".

"So I wanted to know why and I wanted to know how - to delve into his mind to some degree."

Shirdon is believed to have left his home in Calgary in March 2014 to join IS, one of many young westerners who travelled to Iraq and Syria to join the jihadist group.

Makuch eventually published three articles about his conversations with Shirdon, articles that have since embroiled the journalist in a three-year legal battle with Canada's federal police force.

Not long after Vice broadcast a September 2015 Skype interview with Shirdon, during which the self-described IS recruiter said there would be terror attacks in the US, the Royal Canadian Mounted Police (RCMP) served the media company with a production order.

The Mounties are seeking access to all communications Vice had with Shirdon as part of their criminal investigation into the terror suspect. Shirdon has been charged in absentia with six terrorism offences.

Image copyright Reuters Image caption Canada's Supreme Court will hear the press freedom case

Makuch and Vice Media have refused to hand those notes over.

The case raises fundamental questions around how a democracy balances public safety with the constitutionally protected freedom of the press in times of terror.

It will be heard by Canada's Supreme Court on Wednesday.

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

A coalition of 12 such groups will be interveners in this week's hearing.

In a joint statement, they said they would argue that the protection of confidential journalistic material from compelled disclosure is a fundamental to a free press.

Image copyright Alamy

"The outcome in this case will send an important signal about press freedom to other countries," said Joy Hyvarinen, of Index on Censorship, in the statement.

"It is extremely important that Canada's courts ensure the protection of journalistic sources and safeguard press freedom."

Vice argues that if they were to turn over Makuch's notes, it would have a chilling effect on the media's ability to gather and report news.

The RCMP declined to comment on the case because it is before the courts.

In public court documents, the Crown argues that the current legal framework around how the courts approach media freedom is sufficient, and that the information being sought is relevant and necessary to its investigation.

Two lower courts have upheld the RCMP production order.

The Crown's factum also notes that Makuch never promised Shirdon confidentiality - he wasn't a secret source - and that much of what Shirdon told Makuch was eventually published.

Image copyright PA Image caption Ben Makuch communicated with IS fighters online

Toronto-based litigator Andrew Bernstein says all of the above factors will be taken into account by the high court.

"The whole thing is a balancing test and the question is - what's going to go in the balance?" he says.

Still, if the information was already public as suggested, the RCMP wouldn't have to force Vice to produce it, he says.

"I always worry a little bit whenever you hear law enforcement say: 'Yes, we needed to go to extraordinary lengths to get this but it wasn't really private,'" he said.

Bernstein also raised questions as to whether Shirdon will ever stand trial on the terror charges.

"There's reason to believe he's a dangerous individual," said Bernstein.

"The flipside of this is of course that he's a dangerous individual in the Middle East somewhere, and if he's still alive the likelihood of bringing him to trial in Canada seems pretty remote."

In fact, Shirdon is widely believed to be dead.

Last September, a public affairs official with the US Central Command, which is responsible for American activities in the Middle East, told Canadian media that he had been killed in an airstrike in Mosul in July 2015.

The US State Department, however, has placed him in Raqqa, Syria, as late as November 2015, and added him to its terrorism blacklist last year.

His social media accounts have been suspended or removed.

Image copyright Courtesy Vice Media Image caption Ben Makuch

Canada's top court has previously ruled that while journalists have a right to protect sources, it's not absolute.

It's up to the judge signing the production order to weigh the needs of law enforcement with those of the media.

Canada recently passed a new law that adds safeguards to protect confidential sources, though it doesn't apply directly to Makuch's case.

The Supreme Court hearing comes as press freedoms in Canada are under scrutiny. Press groups have cited Makuch's case as well as the surveillance of a handful of Quebec journalists by police as causes for concern.

What the court does is anyone's guess, says Bernstein, but it will probably strike a balance rather than clearly take a side.

Makuch says he is willing to go "as far as necessary" to protect his source, regardless of what the top court eventually decides.

"When you ask a journalist to produce source materials, you're actually co-opting them to be an arm of an intelligence agency or law enforcement agency - and that's fundamentally wrong," he says.

A lot has changed since 2014, when IS forces were declaring a caliphate in parts of Iraq and Syria. The US-led coalition against IS claims 98% of the group's territory has been recaptured.

Like many western countries, Canada is now struggling with what do with returning foreign fighters.

Makuch says since he got a 1am call from his editor telling him the RCMP wanted to seize his notes, he's been living his life in five or eight-month increments as he waits for court hearings and rulings.

Journalists tell him this is making his career, he says.

"But I don't think they understand the stress and the pressure you find yourself under."