A federal grand jury has indicted a 22-year-old Fremont web developer with one count of attempting to provide material support to a designated foreign terrorist organization, though the young man told authorities he only wanted to move away to help Muslim refugees overseas.

"Adam is innocent," Shafi's attorneys said about their client, Adam Shafi, in a statement. "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."

The complaint, which was also unsealed on Thursday, alleges that Shafi tried to provide "personnel" to al-Nusrah Front, or ANF, an organization designated by the Department of State as a terrorist organization. Shafi was arrested on July 3 at San Francisco International Airport on his way to Turkey, a fact that was not publicized until Thursday.

United States Magistrate Judge Sallie Kim in San Francisco set Shafi's bail hearing for Dec. 22 after the Mission San Jose High 2011 graduate entered a plea of not guilty. If convicted, he faces a maximum penalty of 20 years in prison.

22yo Adam Shafi charged with helping terrorist group. Graduated from Mission SJ in Fremont https://t.co/G5trPqVAxA pic.twitter.com/QJqQmVYj9p — Michelle Roberts (@TheRobertsM) December 17, 2015

Prosecutors are not charging Shafi with any violent acts. Rather they allege links to possible terrorist associates, alleged allegiances to a terrorist group, and describe what the FBI calls "suspicious" activities, like exercising in his Fremont neighborhood in what an agent described as a "paramilitary style."

Legal analyst Steven Clark, who used to be a prosecutor and now does defense, said the publicity of this arrest on Thursday is directly linked to the terrorism in San Bernardino, where a radicalized Muslim couple killed 14 innocent people.

"The government wants the public to know, 'We got this,'" Clark said. "But there's a huge leap the government has to make between someone being interested in a terrorist group and proving they wanted to participate in it. I think the government wants to tell the public, 'Stay away from this. Do not participate, or you'll get arrested.'"

The complaint details how Shafi allegedly loved the "nuanced" and "less bloodthirsty" approach to jihad, and how he hung out with several unnamed friends who were sympathetic to the worldwide plight of Muslims. The complaint states that Shafi denounced ISIL for "killing indiscriminately," but supported his "love" for "Jaulani, the amir of the ANF.

Shafi's family emailed NBC Bay Area a statement Thursday afternoon: "We have watched him [Adam] grow over the years into a very kind and loving adult. He is simple in his approach, a helper of mankind, and actively works with the homeless and less fortunate across the bay area. All who know Adam understand that the charges brought against him are not at all a part of his character. His family and friends love him and are hopeful that Adam will be cleared and able to come home soon."

The family declined to speak publicly, but nearby, Rakesh Sharma, told NBC Bay Area that the family seemed "perfect," though he had noticed FBI agents around the neighborhood in the recent past.

Shafi, who is in custody, told the FBI when he was stopped at SFO on June 30, that he was on his way overseas to help refugees. When asked if he was traveling to Turkey to become a fighter, he answered, "No," the complaint states.

However, later, the FBI listened to a phone call where Shafi told his friends, "Friggen (sic) hell, what do you think I'm going to say, yes?"

The Council on American-Islamic Relations in Santa Clara was aware of the case and had no comment.

Federal authorities charged another man with terrorism-related activities Thursday. Enrique Marquez, a former neighbor of the couple who killed 14 in San Bernardino this month, faces three charges, including conspiring with Syed Rizwan Farook to commit terrorism – the first charges filed in the San Bernardino plot that went undetected by terrorism investigators.

In Shafi's case, the FBI affidavit alleges that Shafi was stopped at SFO for questioning as he was about to board a non-stop flight to Istanbul, Turkey. That country is a "common point of entry into Syria for foreign fighters hoping to join terrorist organizations such as ANF and Islamic State of Iraq and the Levant (ISIL)," the affidavit states.

Shafi had a one-way ticket and was acting "suspiciously," according to the complaint. When he was stopped by agents, Shafi said he no longer wanted to live in the United States, and he disapproved of gay marriage, listing just one of the reasons he wanted to live in a country with people who thought like himself, the complaint states.

The affidavit details a number of alleged telephone conversations Shafi had with his friends in the days and weeks leading up to his trip and his willingness to "die with them," his hope that "Allah doesn’t take [his] soul until [he has] at least, like, a couple gallons of blood that [he’s] spilled for him," his fear of meeting Allah "when [his] face has no scars on it," and his progress in saving enough money for his trip, the affidavit alleges.

The complaint states that Shafi's family had been worried about him since at least last summer, during a trip to Egypt.

His father reported Shafi's disappearance in August 2014 to the U.S. Embassy in Cairo. The family had gone there for a family trip and Shafi had taken off without telling anyone where he was going. He sent a text message to one of his relatives saying he had gone to "protect Muslims," the father told authorities.

His father explained that he was afraid his son had been recruited and that it was important to find him quickly to prevent him from "doing harm to himself or others," according to the 18-page complaint written by FBI agent Christopher Monika.

Shafi's father worried that his son may have traveled to Syria, Iraq, Gaza or elsewhere to "defend Muslims," the complaint states. Shafi's father was disturbed because his son was "always grieving about what is happening to Muslims," documents states. His father also worried that his son may have been following extreme imams online, and that some of his "high school friends were of the same mindset."

But at some point that week, Shafi's father notified the embassy that his son had returned to them in Egypt and they were soon headed back to the United States, according to the complaint.

After they returned in September 2014, FBI agents interviewed Shafi back at home, where he told authorities that he and his friend flew to Istanbul to "see the condition of the refugees from Syria firsthand" and help them, the complaint states. He didn't tell his family, he told the agents, because he knew they wouldn't want him to go.

He had been traveling and communicating with an individual known in court documents only as A.N., who had listed cryptic messages about "possible entry points" to a river that separates Syria and Turkey in an email. Other friends identified only with initials were also mentioned in the court documents.

In December 2014, FBI agents secretly watched Shafi leading his two younger brothers in "paramilitary style" exercises, including calisthenics and crawling through the mud in Fremont, the complaint states. "Adam appeared to take the training more seriously than his younger brothers did," the complaint states.

This week, NBC Bay Area learned that an accused high-level terrorist, Armin Harcevic, and five other defendants accused of supplying money and equipment to terrorist fighters, including the Islamic State, had been housed for a time in Santa Clara County's main jail. When Harcevic was housed there is unclear.

Shafi is not the first Bay Area resident to be charged with terrorism.

In 2013, the FBI arrested 28-year-old Matthew Adam Llaneza of San Jose for being part of an Oakland bank "bomb plot."

In that case, the bomb turned out to be fake and raised questions, according to the East Bay Express, Mother Jones and other media outlets, of possible entrapment in supposed "terrorism" cases,

Still, Llaneza was sentenced to 15 years in prison last year after striking a deal with prosecutors.

[[362873051, C]]

NBC Bay Area's Jessica Aguirre and Michelle Roberts contributed to this report.