When you're entering the United States, whether at an airport or a border crossing, federal agents have broad authority to search citizens and visitors alike.
And that can include flipping through your phone, computer, and any other electronic devices you have with you.
As the US Customs and Border Protection outlines in a tearsheet it provides to people at the border, federal agents can seize and search your phone, and even make a copy of it to have forensic experts analyze its contents off-site.
Department of Homeland Security data reviewed by NBC News found that agents looked through almost 25,000 phones in 2016 alone, a huge spike. In 25 cases NBC analyzed by talking to people who had their phones searched at the border and verifying the instances with experts, 23 of the victims were Muslim.
How can they do that?
The Supreme Court decided in 1976 and 2004 that people have fewer claims to their Fourth Amendment privacy rights granted by the Constitution when entering the country, because the government has to protect its borders.
While the court has ruled that police can't search peoples' phones inside the country without a warrant because they contain troves of personal information, it hasn't yet decided on a case about phone searches at the border.
"Searches of people at the border is an area where there's a wide gap between what we think people's rights are and what their facts are on the ground," Nathan Freed Wessler, a staff attorney with the American Civil Liberties Union, told Business Insider. "Various courts haven't had an opportunity to weigh in on these issues yet, so CBP is operating with a lot of claimed authority and a lot of latitude."
Here's what you need to know and what you can do to protect the personal information on your electronic devices at the border:
Can you refuse to give them your phone?
Yes, but border agents can then make your life difficult.
Wessler said agents can detain you — courts are divided on how long is too long — take your phone and try to unlock it on site, and even take your phone and send to experts to unlock it.
They may also make copies of your devices to peruse later. The Department of Homeland Security says it will destroy that copy if the data's not "necessary for law enforcement purposes."
If you are a citizen or legal permanent resident, a green-card holder, they have to let you back into the country eventually. If you are not a citizen, border agents can refuse your entry to the US.
"People need to decide whether they're willing to endure those inconveniences when they're deciding whether to give their password," Wessler said. "For noncitizens, visa holders, and others, people often need to consider whether there's a risk they'll be denied entry and turned away at the border for refusing to comply. We've received scattered results of that happening."
Can you say you have confidential files on your phone?
Lawyers, medical professionals, and journalists can say they have privileged, confidential files, Wessler said, but there is no guarantee agents will recognize it as a deterrent.
CBP has recognized that lawyers, in particular, have attorney-client privilege and that agents have to get approval from an agency attorney before proceeding with the search — but they can still search the phone.
Should you ask for a lawyer?
If you decline to unlock your phone and agents give you a hard time, Wessler said you should feel "empowered" to ask for a lawyer, though you would have to pay for their services yourself. The government is not required to provide you with one for free if you ask.
If you anticipate running into issues at the border, Wessler said, it would help to carry a signed letter from your attorney saying they would represent you.
"US citizens and green-card holders have the right to request an attorney," he said. "It's not clear at all whether the government has been respecting those requests to the extent that it should."
How common is it?
From October 2008 to June 2010, over 6,500 people had their electronic devices searched at the border, nearly half of whom were US citizens, according to government data provided to the ACLU through a Freedom of Information Act request.
Wessler said that while seizing phones at the border "is not a new problem," the ACLU has seen an uptick in people saying their devices have been searched.
A CBP spokesman told The New York Times that agents inspected 4,444 cellphones and 320 other electronic devices in 2015 — a relatively small number compared with the 383 million arrivals recorded in the US that year.
But DHS data reviewed by NBC News found that agents analyzed almost 25,000 phones last year, a 460% increase.
How can you protect your data?
First, Wessler says, travel only with the data that you need. That may mean using burner phones or laptops for traveling. After all, he said, "authorities can't search what you don't have."
Second, use encryption services. The Electronic Frontier Foundation and Wired both have exhaustive guides to keeping federal authorities — or hackers, for that matter — from accessing your data. Always choose long, strong, unique passwords for each device and account.
Third, turn your devices completely off before going through customs. This is when the encryption services are at their strongest.
These recommendations aren't options for everyone, but adopting one or more of them can help you keep your data under wraps.
Will this change in the future?
The Ninth US Circuit Court of Appeals — covering Alaska, Arizona, California, Hawaii, Idaho, Montana, Nevada, Oregon, and Washington — has ruled that border agents must demonstrate a reasonable suspicion of criminal wrongdoing before doing a full forensic search of electronic devices, in which they download and analyze the full contents. However, they can do a cursory search, in which they thumb through the phone, without that suspicion.
"In the rest of the country," Wessler said, "the government still claims the authority to do any search they want of any electronic device anytime they want to, which we think is a gross violation of people's privacy rights under the Fourth Amendment, but the cases have yet to work their way into the courts."
More From Business Insider