Canadian police can search the contents of a mobile phone after arrest, the Supreme Court of Canada has ruled.
In a 4-3 decision, the court said a warrant was not needed as long as the search is directly related to the suspected crime and records are kept.
The dissenting judges argued phones were an "intensely personal and uniquely pervasive sphere of privacy".
The outcome is opposite from a similar case decided in the US Supreme Court in June.
In a unanimous decision, the US high court said searches of mobile phones must require a warrant, with few exceptions.
Canada's lower courts were previously divided on the issue.
On Thursday, the Supreme Court of Canada ruled in the case of Kevin Fearon, who was convicted of robbery with a firearm after police searched his phone.
The search was made after he was arrested but before police had a warrant to search his vehicle and other belongings.
They found a draft text message in his phone with a picture of a gun and the words "We did it".
The high court dismissed Fearon's appeal against his conviction, but outlined rules for how police should handle mobile phone searches.
"In my view, we can achieve that balance with a rule that permits searches of cell phones incident to arrest, provided that the search - both what is searched and how it is searched - is strictly incidental to the arrest and that the police keep detailed notes of what has been searched and why," Justice Thomas Cromwell wrote in the opinion.
The three judges in the minority said existing law "already provides flexibility where there are exigent circumstances" for a warrantless search, including safety of the public or to prevent destruction of evidence, and should be limited to these instances.
"The intensely personal and uniquely pervasive sphere of privacy in our personal computers requires protection that is clear, practical and effective," Judge Andromache Karakatsanis wrote for the minority
The majority had provided an "overly complicated template" for police to follow, she added.