A US Court of Appeals has upheld a ruling that American border agents cannot randomly order deep searches of travelers' electronic devices.

The three-judge panel at the Fourth Circuit Court of Appeals all agreed on Wednesday that officials will need to have at least "reasonable suspicion" of a crime in order to obtain a forensic analysis of a phone or computer belonging to someone coming into the States.

The decision, affirming a district court ruling from 2016, is being hailed as a victory for privacy advocates seeking stronger requirements for device searches at borders and entry points.

US government sued by 11 pissed-off travellers over computer searches READ MORE

The ruling addresses the 2016 case of Hamza Kolsuz, a man who was arrested while trying to board a flight to Turkey. Suspecting that Kolsuz, who had twice before been found illegally transporting firearms, might be carrying illegal weapons parts, agents stopped the man and searched his bag, only to find firearm magazines and gun conversion kits that were not legal to carry out of the country.

In addition to the physical search, officials also perform a forensic analysis of Kolsuz' phone, yielding data that was used as evidence in his eventual trial. Kolsuz' lawyers had argued the forensic search was not legal as it required a higher standard of evidence than the random search of his bag.

Here is where things get a bit complex (and bad for Kolsuz). The district court agreed that, indeed, a forensic search of a phone by border agents needs to be based on something more than just a whim - the g-men need a reasonable suspicion of wrongdoing. This puts forensic device searches in the same category as body cavity or alimentary canal searches (the rubber glove treatment).

Unfortunately for Kolsuz, the court also found that his two previous problems with the law were more than enough to merit the reasonable suspicion necessary to perform a forensic search on his phone. His convictions on charges of attempting to smuggle firearms and conspiracy will stand, as will his 30 month prison sentence.

While the defendant in this case may not be getting what he wants, Kolsuz' backers are at least claiming partial victory in that the appeals court upheld the decision that device searches require something more than the whim of border agents. By placing a higher standard for obtaining forensic searches, they believe travelers will have a bit more protection for their personal privacy.

"This is a win for constitutional rights at the border," said Esha Bhandari, an ACLU attorney handling the case.

"The court has rightly recognized the severity of the privacy violations that travelers face when the government conducts suspicionless border searches of electronics." ®