Some form of individualized suspicion is needed before the government can use forensic software to search a cellphone seized at the border, a federal appeals court said Wednesday.

The decision by the Richmond, Virginia-based 4th U.S. Circuit Court of Appeals was considered a victory by privacy advocates, though the Turkish citizen challenging the forensic search of his iPhone did not benefit.

The appeals court said border patrol officers had reasonable suspicion to conduct a forensic search of Hamza Kolsuz’s cellphone, and they were entitled to rely on that standard based on case law that suggested it was, at most, all that was required.

The officers had seized Kolsuz’s phone after they found firearms parts that required an export license in his checked luggage. It was the third time weapons parts were found in his luggage.

The forensic search of Kolsuz’s phone produced information that included personal contact lists, emails, messenger conversations, photographs, videos, calendar, web browsing history, call logs and GPS tracking history. He was sentenced to 30 months in prison after a conviction for violating the Arms Export Control Act and conspiracy.

The federal government has contended that searches of electronic devices require no warrant or individualized suspicion under an exception that allows searches of suitcases at the border.

The decision is the first federal appellate ruling to require individualized suspicion in a border search of a cellphone since the U.S. Supreme Court ruled in Riley v. California in 2014 that police generally can’t search the contents of a cellphone seized during an arrest, unless they get a warrant, according to the EFF.

The San Francisco-based 9th U.S. Circuit Court of Appeals had held in 2013, before Riley was decided, that reasonable suspicion is needed for a forensic search of a computer seized at the border, but not for a manual search. The case was United States v. Cotterman.

Under Riley’s recognition of the extensive information stored on cellphones, the 4th Circuit said, the forensic search of Kolsuz’s phone should be considered a nonroutine border search that requires some measure of individualized suspicion.

The EFF and the ACLU had filed amicus briefs urging the 4th Circuit to go further and hold that probable cause is needed before a search of electronic devices, whether it’s a manual search or one using forensic software.

The 4th Circuit case is United States v. Kolsuz. After arguments in the case, the Department of Homeland Security adopted a policy that treats forensic searches of digital devices as nonroutine border searches requiring reasonable suspicion of activity that violates the customs laws or in cases raising national security concerns, according to the opinion.

The department also clarified its policies in January on how it intends to protected privileged information of lawyers’ electronic devices after the American Bar Association raised concerns.

The ACLU and the EFF have filed a separate lawsuit that challenges warrantless searches of electronic devices at the border.