Reporters will have an easier time protecting their anonymous sources from police after politicians of all stripes endorsed a bill introduced by a Conservative senator that raises the bar for the issuance of search warrants.

The bill, which amends the Criminal Code and the Canada Evidence Act to enhance the protection of journalistic sources, was passed unanimously in the House of Commons on Wednesday evening and brings Canada in line with most other industrialized countries in terms of protecting press freedom.

Gérard Deltell, a Conservative MP and former journalist who sponsored Bill S-231 in the House, said the passage of the legislation marked a great day for democracy, for journalism, and for the quality of information that is available to Canadians.

Story continues below advertisement

"It's not a free pass for a journalist but it protects the sources," Mr. Deltell said in a telephone interview. "And also I think there is some clear message that, now, if policemen want to investigate journalists, you have to receive the authorization of a Superior Court judge."

The bill was first introduced in the Senate by Claude Carignan, a Conservative who is the former leader of his party in the Red Chamber. It is rare that a private member's bill becomes law, and rarer still for a bill that is initiated by an opposition senator to get to this stage. But members of Parliament on all sides of the House agreed the changes it enacts are necessary.

The Liberal government supported the legislation after making a few amendments that were acceptable to Mr. Carignan. Until the bill receives royal assent, police who wish to gain access to a journalist's source material can obtain a warrant from a lower-level justice of the peace.

The new law means journalists will not be required to disclose any information or document that is likely to identify a confidential source unless the police can persuade a Superior Court judge that the information cannot be obtained through any other means. In addition, the judge must agree that the disclosure is in the public interest, that it will assist in the administration of justice and that it is more important than protecting the source's identity.

And even when journalists are required to hand over such information, every effort must be made to preserve the anonymity of the source.

Canadian news organizations have broadly praised the legislation saying whistle blowers must be shielded from police who are on investigative fishing expeditions and that journalism can only thrive if sources believe their names will be kept secret.

Peter Jacobsen, a Canadian media lawyer who advises The Globe and Mail, said: "This is a very significant initiative that will enhance freedom of expression in Canada by protecting both journalists and their sources when pursuing matters of public interest."

Story continues below advertisement

Mr. Carignan tabled his bill last November after police in Quebec who were trying to stop leaks of information to the media allegedly used questionable tactics to secure warrants that allowed them to obtain the telephone records of eight journalists and to track a reporter using his cellphone, in one instance.

VICE Canada, meanwhile, is fighting a court action launched by the RCMP to force its journalist, Ben Makuch, to hand over his chat logs with a Calgary man who is believed to have been killed while fighting in Syria and Iraq for the Islamic State. VICE issued a statement Tuesday praising the bill but said it does not go far enough. "No journalist should face potential jail time for doing their job," the statement said.

Duncan Pike, the advocacy co-ordinator for Canadian Journalists for Free Expression, said the bill marks the beginning of the full legal recognition of the role that journalists play in serving the public and protecting democracy.

"The ability to have confidential and anonymous sources, to be able to pass along information to journalists and to give them tips and to expose wrongdoing or corruption has been central to some of the biggest stories in Canadian history," including the unveiling of the Liberal sponsorship scandal by The Globe, Mr. Pike said.

This legislation "really addresses some of the most egregious shortfalls in Canadian law right now," he said, "and we think it's a really historic step forward for press freedom in Canada."