FREMONT (CBS SF) – A Fremont man appeared in federal court Thursday morning on charges that he tried to travel to Syria and join a branch of Al-Qaeda there, according to the U.S. Attorney’s Office.

Adam Shafi, 22, was indicted over the summer and detained at San Francisco International Airport as he tried to board a flight to Istanbul on June 30, prosecutors said.

READ MORE: San Jose Becomes First City In Nation To Require Gun Liability Insurance

Shafi allegedly intended to go from Istanbul to Syria to join the al-Nusrah Front, a branch of al-Qaeda operating in Syria and a designated terrorist group, according to the federal government.

He first came to the attention of federal investigators during the summer of 2014, when he was visiting Cairo with his family but disappeared for a few days, according to an affadavit filed by FBI Agent Christopher Monika.

When his father reported him missing, he said he was afraid that his son had been recruited and may have traveled to Syria, Iraq or Gaza and joined a violent extremist movement, according to Monika.

READ MORE: Woman Charged With Hate Crime Following Anti-Muslim Rant At East Bay Park

Shafi surfaced a few days later and said he had been in Istanbul.  When questioned by FBI agents, he said he was trying to provide assistance to Syrian refugees. He didn’t tell his family because they wouldn’t have let him go, Monika said.

After finding Shafi had contact with possible extremists, the FBI started surveillance on him later that year.

READ MORE: Curry And Warriors Rout Mavericks, 130-92

The following June, investigators intercepted phone calls of him expressing admiration for al-Nusrah Front and a willingness to fight and die for the group. He said he was raising money to travel to Syria to join them, according to Monika.

On June 16, Shafi told a friend on the phone in a recorded conversation, “I just hope Allah doesn’t take my soul until I have at least, like, a couple gallons of blood that I’ve spilled for him. At least, something like that… I just really hope so. How can I meet Allah when my face has no scars on it…”

Over the next two weeks, investigators learned he was planning to travel to Syria and intercepted him before he boarded a flight to Istanbul.

Shafi was indicted by a federal grand jury for one count of attempting to providing material support or resources to a designated terrorist organization.

He was arraigned on the charge this morning when he appeared in the courtroom of U.S. Magistrate Judge Sallie Kim and is scheduled to appear for a bail hearing on Tuesday, prosecutors said.

If convicted, he could face up to 20 years in prison and a $250,000 fine.

MORE NEWS: Oakland Chinatown Cash-Only Businesses Convert To Credit To Stop Attacks On Asians

© Copyright 2015 by CBS San Francisco and Bay City News Service. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.