My husband and I are driving to the United States next month for a family wedding and I'm worried that we might not make it through the border – especially if they ask to see our cellphones. I post a lot about politics on Facebook and my husband is originally from a Muslim country. What if they ask me whether I support Donald Trump? Do we have to give them our phone or social media passwords? If we don't, could they ban us? – Kirstie, Vancouver.

If you don't hand over your iPhone password at the U.S. border, you'll likely be sent back home. But keeping mum isn't supposed to get you banned, lawyers said.

"Based on security measures, yes, they are allowed to look at cellphones, laptops, and tablets, and they can ask for the passwords – but it doesn't mean the individual has to provide those passwords," said Fadi Minawi, a Toronto immigration lawyer. "If you're not co-operating, it's more than likely that they'll turn that person away – but a ban cannot be issued just because you didn't provide a password."

Story continues below advertisement

If they do turn you away for not handing over your password, when can you try again?

You can go back whenever you want," said Mark Belanger, a Vancouver lawyer who specializes in border issues. "There's no protocol for what could happen, but I would imagine you would not be getting red carpet treatment.

You can also reach out to "a supervisor or a chief" to "better gauge their reasons for wanting to search your devices," Minawi said. "There's also a traveller redress program which has not been very helpful."

Belanger says there's no legal basis to ban you for refusing to give a password – but that doesn't mean it can't happen.

"They can do whatever they want on the spot – they're judge, jury and executioner," Belanger said. "If it were challenged in court, it wouldn't hold up – but you'd have to file in federal court and it would cost $100,000 in legal fees."

Instead, a public interest group would likely have to challenge the ban in court on the behalf of someone who'd been banned, Belanger said.

Why do they search devices at the border?

Story continues below advertisement

"Keeping Americans safe and enforcing our nation's laws in an increasingly digital world depends on our ability to lawfully screen all materials – electronic or otherwise – entering the United States," said U.S. Customs and Border Protection (CBP) spokesman Jason Givens in an e-mail. "Laptops and other electronic devices may be subject to detention for violations of law such as child pornography, narcotics smuggling, ties to terrorism or other criminal activity."

We asked for the number of searches this year and last year and Givens said the information wasn't available. But The Associated Press reported 23,877 electronic media searches in 2016, while still under the Obama administration, compared to 4,764 in fiscal year 2015.

While the 2016 number is higher, it's .0061 per cent of total arrivals into the United States.

At the border, even if you don't give your password, officers can also temporarily confiscate your device, Minawi said. "They can send it back to their experts to try to crack," he said. "I've never heard of it happening to any clients of mine."

Belanger argues that device searches on U.S. soil violate Fourth Amendment protections against unreasonable search and seizure, even if you're Canadian.

"That's not (CBP's) position, obviously – they say they're the defender of the nation and they have unlimited discretion to access you information," he said.

Story continues below advertisement

If you do give them access to your phone, what can they use to ban you? Well, they can ban you for photos showing you in illegal activities – like smoking weed, Belanger said.

But, the agency said it "strictly prohibits profiling on the basis of race or religion."

After U.S. President Donald Trump issued a 90-day ban – since suspended by court rulings – on travellers from seven predominantly Muslim nations last month, a U.S.-born scientist said he was detained in Houston until he unlocked his NASA-issued work phone.

And, there were news reports of Canadians banned from crossing into the United States because of materials found on devices.

That included a Morrocan-born university student with a Canadian passport who said he was denied entry after border officers found a Facebook photo with another student believed to have left Canada in 2014 to join Islamist fighters in Syria.

"I highly doubt they'd ban someone just for saying, 'I wouldn't vote for Donald Trump – that doesn't make any sense," Belanger said. "I suspect you'd have to be on some list or have some suspected ties."

Story continues below advertisement

Even if you make it into the United States without getting asked for your password, you could be asked for it by Canada Border Security Agency (CBSA) officers when you try to re-enter Canada.

"CBSA officers have the legal authority under Section 99 of the Customs Act to examine personal baggage, including personal electronic devices, and conveyances and goods upon arrival into and on departure from Canada," a CBSA spokesman said in an e-mail.

It doesn't matter whether or not you're a Canadian citizen – they can still search you.

“Anyone could be subject to such a search,” said Matthew Jeffery, a Toronto immigration lawyer. “To be clear, there is no specific legal authority enabling CBSA to conduct searches of electronic devices, rather they rely on vague sections of the law to support their interpretation that they have such authority.”

So, if you don't want devices searched, what can you do?

You could just not bring them with you. Or, make sure that you've deleted anything – from your device and from your social media account – that you don't want officers to see.

Story continues below advertisement

And when they start asking questions?

"Generally, it's best to be truthful and answer what's being asked – don't say more than what's needed," he said. "If there are any questions from the CBP Officer that may cause admissibility issues, it would be best to refuse to answer and to be turned away."

Due to technical reasons, we have temporarily removed commenting from our articles. We hope to have this fixed soon. Thank you for your patience. If you are looking to give feedback on our new site, please send it along to feedback@globeandmail.com. If you want to write a letter to the editor, please forward to letters@globeandmail.com.

Welcome to The Globe and Mail’s comment community. This is a space where subscribers can engage with each other and Globe staff. Non-subscribers can read and sort comments but will not be able to engage with them in any way. Click here to subscribe.

Welcome to The Globe and Mail’s comment community. This is a space where subscribers can engage with each other and Globe staff. Non-subscribers can read and sort comments but will not be able to engage with them in any way. Click here to subscribe.