Agents allowed Shafi to leave the airport and return to Fremont. He was arrested July 3 based on the FBI affidavit, which was sealed until Thursday.
Shafi's attorney, New York City lawyer Joshua Dratel, issued a statement declaring his client's innocence.
“There is no evidence that he was planning to do anything but fly to Istanbul, which is where he had been the year before for two days where he attempted to help the refugees and returned home,” Dratel said. “... He told the agents more than once that he was not flying to Istanbul to join any terrorist organization, and there's no evidence to the contrary."
The FBI's affidavit says Shafi came to U.S. officials' attention during a family vacation to Egypt in August 2014. Shafi's father contacted the U.S. Embassy in Cairo to report that his son had "disappeared without telling anyone in the family where he was going."
The FBI says it learned from an informant that Shafi had flown to Istanbul to meet a friend from the Bay Area -- identified only as A.N. -- and that both young men had planned to join a group fighting in Syria. The affidavit cites court-authorized intercepts of telephone conversations during which Shafi discussed traveling to the Middle East to join the al-Nusra Front.
Agents were also keeping an eye on Shafi, with the affidavit reporting that in December 2014, "an FBI surveillance team observed Adam leading his two younger brothers in exercises described as 'paramilitary style' training that included calisthenics, running through the neighborhood and crawling through the mud at a park near their home in Fremont. Adam appeared to take the training more seriously than his younger brothers did."
The affidavit says that in a series of phone conversations intercepted in June 2015, Shafi repeatedly expressed a desire to fight with the al-Nusra Front and voiced his willingness to become a martyr.
"I just hope Allah doesn't take my soul until I have at least, like, a couple of gallons of blood that I've spilled for him," Shafi reportedly told a friend referred to only as S.K. "At least, something like that ... I just really hope so. How can I meet Allah when my face has no scars on it ... I'm just so scared of that. Know what I mean?"
During another call in June, the affidavit says, Shafi and S.K. discussed the possibility of joining a jihad to aid Burmese Muslims. Shafi reportedly responded to the idea by saying, "The only thing about going to Burma is I really want to kill some frickin' people that were supporting America or American soldiers or something."
When he was stopped at SFO's International Terminal on June 30, the affidavit says, he had drawn attention not only from customs agents near his departure gate but also from fellow passengers on Turkish Airlines Flight 80:
"... A flight 80 passenger ... had approached gate personnel to notify them that a fellow passenger, who she later identified as Adam, was making her nervous. The passenger and the passenger's family had noticed Adam because he was acting 'suspicious' and they did not feel comfortable boarding a flight with him. As the passenger described it, Adam appeared nervous and his leg was shaking. He was reading a book and was alternately mumbling and speaking loudly to himself as he read. Adam also removed and wiped his glasses frequently as he sat in the boarding area."
Both the affidavit and indictment are embedded below.