Courtesy Andreas Gal(SAN FRANCISCO) — When Apple employee Andreas Gal returns from an international trip, he said he’s usually on his way home within minutes.

But when he arrived at San Francisco International Airport last November, he was detained for an hour by three armed U.S. Customs and Border Protection (CBP) agents, who demanded access to his iPhone XS and MacBook Pro laptop, he said.

“They insisted on searching the contents of my cell phone and my laptop that were issued to me by Apple,” Gal told ABC News. “Which put me in a difficult situation because I signed NDAs (non-disclosure agreements) for those devices. They are owned by Apple and they contain proprietary information from Apple.”

The border patrol agents asked about Gal’s work at his former employer, Mozilla – the company which makes the Firefox internet browser – as well as his current work at Apple and his business trip to Sweden, Gal said.

“They wanted to see my itinerary on my smartphone. I offered to email them my itinerary and they insisted on seeing it on my smartphone. This was very alarming for me. These are not regular consumer devices. These are special devices used by Apple software and hardware engineers,” Gal said.

Apple declined to comment for this story.

“That seemed to aggravate these customs agents and they started getting very upset with me and they said they had the right to access my devices and I had to turn over my passport,” Gal said. “I told them I wanted to talk to an attorney and my employer so I could understand my responsibilities with regard to this NDA.”

The agents threatened to criminally charge Gal under accusations that he was in violation of U.S. Code § 111, he said. That section of federal law relates to assaulting, resisting, or impeding certain government agents.

Gal’s detention and alleged threats by the CBP agents, resulted in a civil rights complaint filed on March 28 by the American Civil Liberties Union Foundation (ACLU) of Northern California against the United States. The complaint alleges that the search of Gal’s possessions violated the Fourth and First Amendments, which protects U.S. citizens from unreasonable searches and seizures and protects free speech.

In the 10 years prior to becoming a citizen, Gal said he made about 100 international trips, all without incident.

“They told me at the border, even as a U.S. citizen, I don’t have any rights to an attorney,” Gal, who became a U.S. citizen three years ago, said. “I told them I wanted to speak to an attorney. Then they said they would keep my devices and I said I don’t consent to it but I would comply.”

“I think by me resisting their unlawful demands, I think at some point they saw there’s nothing further they can do or say to change my mind and then they decided to let me go,” he said. He said in the end he was able to keep his devices and never unlocked them for the agents or handed over his passwords.

As Gal was leaving, the CBP agents confiscated his Global Entry card and revoked his status. Global Entry is a program administered by CBP which allows pre-screened, low-risk international travelers to skip security lines upon arrival in the U.S.

On his next return from Europe, Gal noticed the code “SSSS” on his boarding pass, indicating a secondary security screening. Prior to the November incident, Gal was never subject to a secondary screening in any of his border crossings back into the U.S., he said.

A spokesperson from CBP told ABC News in an email that they could not comment on Gal’s situation as it is “currently under investigation.”

“However, in general, all travelers arriving to the U.S. are subject to CBP inspection. This inspection may include electronic devices such as computers, disks, drives, tapes, mobile phones and other communication devices, cameras, music and other media players and any other electronic or digital devices,” the spokesperson wrote, in part.

The CBP spokesperson also said that travelers who do not provide the items requested by their agents “may result in the detention and/or seizure of the electronic device.”

Between 2016 and 2017, CBP had a 59% jump in the number of searches of electronic devices, according to the agency’s data.

“Approximately 0.007 percent of arriving international travelers processed by CBP officers (more than 397 million) had their electronic devices searched (more than 29,200). In FY16, 0.005 percent of arriving international travelers (more than 390 million) had their electronic devices searched (more than 18,400),” a CBP spokesperson wrote in an email.

One of the reasons Gal said he filed the complaint was to find out why he was flagged for detention.

“Why me? I’m a boring, middle-aged white male software executive. I’m very average. It’s not something I would have expected to experience, to get yelled at by three armed men just because I return home,” Gal said.

Gal charged that his stop by CBP agents may be because of his work at Mozilla and the company’s views on opposing the government’s warrantless mass surveillance.

“In the past two years I’ve been very outspoken on the Trump administration’s policies on social media, particularly with respect to Customs and Border Protection and immigration,” said Gal.

The ACLU complaint states that such searches may unlawfully curb the behavior of citizens like Gal.

“Furthermore, singling out a traveler for invasive questioning and search on the basis of his avowed political viewpoints threatens to chill the traveling public from exercising their First Amendment rights publicly as well,” the complaint read, in part. “Those who expect to travel internationally may self-censor what they say in public, knowing that CBP officers might target those with disfavored political viewpoints for questioning and searches at the border that go beyond immigration or customs matters.”

Gal said the experience invoked a fear of traveling.

“It was a very alarming experience for me,” he told ABC News. “There’s no such thing as a cursory inspection of the contents of your cell phone…This is essentially my entire life for the last 10 to 15 years I’m carrying with me on my cell phone. And CBP seems to believe without a court-issued warrant they can inspect the last 10 to 15 years of my life just because I’m travelling internationally.”

Gal had also alerted his Congresswoman, Jackie Speier, about the incident. Speier contacted CBP about the situation and the agency stood by their inspection of Gal, according to a letter whose contents were shared with ABC News.

“If being searched and threatened with criminal prosecution by three armed men for an hour and denied access to a lawyer and then having your Global Entry card and status taken is ‘an inspection without incident’ I don’t want to know what an ‘inspection WITH incident’ looks like,” Gal wrote in a text message to ABC News.

Copyright © 2019, ABC Radio. All rights reserved.