NEW YORK (AP) — A native New Yorker accused of conspiring to join al-Qaida returned to the United States from Yemen after pledging allegiance to the terror group and tried to start his own "mini al-Qaida cell," a prosecutor said Wednesday.

The latest allegation against Wesam El-Hanafi came as Assistant U.S. Attorney John Cronan successfully argued to a federal magistrate judge that he should be held without bail because he was a danger to the community.

The Brooklyn-born El-Hanafi was making his first appearance in U.S. District Court in Manhattan since being transferred from Virginia. He was arrested in Virginia on April 30 after he was brought to the United States from Dubai, where he had been working.

Cronan said El-Hanafi went to Yemen in February 2008 and was met by people who put a hood over his head and took him to a place where he pledged loyalty to al-Qaida and helped teach the group how to communicate on the Internet without being detected.

"This is not just someone who swore loyalty," Cronan said. "He helped the group."

Cronan said when El-Hanafi returned home, he tried to assume a leadership role in al-Qaida.

"He basically formed his own mini al-Qaida cell," Cronan said, alleging El-Hanafi reached out to others he thought were sympathetic to the aspirations of the group.

He said El-Hanafi also supplied cash to al-Qaida, including one payment of $35,000, and tried to help the group by buying seven Casio wristwatches that could be used to trigger a detonation device on an explosive.

El-Hanafi, who smiled toward more than a dozen family members and friends as he entered court, pleaded not guilty to charges he conspired to modernize al-Qaida with computer expertise along with a co-defendant, Sabirhan Hasanoff. Hasanoff, who also has pleaded not guilty, already was ordered held without bail.

El-Hanafi's lawyer, JaneAnne Murray, argued for her client to be fitted with electronic monitoring and freed to stay with relatives, who were willing to post $1.5 million in property.

She said he was notified early this year that he had been put on the no-fly list while in Dubai and had fought to clear his name so he could return home to be with his wife and three children. She said he continued to seek to return to the U.S. even after he was told he had been indicted.

"In an instance where a person who was a flight risk would flee, he did the opposite," Murray said.

She said the government evidence included Internet chats in which her client didn't participate and the claims of an informant who had an incentive to "exaggerate and fabricate."