(CNN) -- Hayatullah Dawari is a former doctor in Philadelphia who treated American troops in his native Afghanistan while working with the American Red Cross, according to his lawyer.
But in the eyes of the United States government, Dawari has been working with an anti-Western insurgent group in Afghanistan with ties to al Qaeda.
These two very different images of Dawari emerged after he appeared Friday in federal court in Philadelphia on immigration fraud charges.
"We intend to prove he was a member of HIG while he lived back in Afghanistan and Pakistan," Assistant U.S. Attorney Jennifer Arbittier Williams told CNN. She was referring to Hezb-e-Islami Gulbuddin, an Afghan political party and militant organization founded by a man the U.S. Treasury Department has designated a terrorist.
According to court documents, Dawari has been in touch with HIG associates in Pakistan and in January was the intended recipient of a book sent from Pakistan containing a secret message glued between two pages.
The note, when translated to English, "appears to contain a coded message directing some urgent action," according to court documents.
"He has no idea what they're talking about," said Nino Tinari, Dawari's attorney. "There are no coded messages. There was no reason to have any coded message."
According to Tinari, Dawari planned on using the book, which was intercepted by the FBI before Dawari was able to receive it, to teach children at his mosque.
Tinari told CNN affiliate WPVI that his client may have treated members of terrorist organizations as a doctor in Afghanistan before coming to the United States in 2008 but that he himself is not a terrorist.
The government has not charged Dawari with any terrorism charges. The court case stems from charges of immigration fraud.
According to court documents, Dawari neglected to document his association with HIG in a 2013 application for U.S. citizenship.
On the application, he was asked, "Have you ever been a member of or associated with any organization, association, fund, foundation, party, club, society, or similar group in the United States or in any place?" He placed an "X" in the box marked "No," the court papers said.
The prosecution alleged that Dawari confirmed his membership in the group during a telephone call within weeks of submitting his naturalization application.
Court papers described HIG as a "violent, anti-western terrorist group ... affiliated with al Qaida, and it has claimed responsibility for many attacks against U.S. and coalition forces."
Dawari, 62, who pleaded not guilty Friday, was ordered held without bail.
The prosecution argued that Dawari is a severe flight risk and a serious danger to the community.
If convicted, Dawari faces a maximum charge of 20 years' in prison and deportation.
CNN's Haimy Assefa contributed to this story.