BALTIMORE - A 21-year-old part-time construction worker obsessed with jihad was arrested Wednesday when he tried to detonate what he thought was a bomb at a military recruitment center - the second time in less than two weeks that an alleged homegrown extremist was nabbed in a sting operation.

Antonio Martinez, a naturalized U.S. citizen who goes by the name Muhammad Hussain, faces charges of attempted murder of federal officers and attempted use of a weapon of mass destruction, according to court documents filed Wednesday.

The bomb he is accused of trying to detonate was fake and had been provided by an undercover FBI agent. It was loaded into an SUV that Martinez parked in front of the recruiting center, authorities said, and an FBI informant picked him up and drove him to a nearby vantage point where he tried to set it off.

"There was never any actual danger to the public during this operation this morning," U.S. Attorney Rod J. Rosenstein said. "That's because the FBI was controlling the situation."

Martinez, who had recently converted to Islam, appeared in U.S. District Court in Baltimore and was ordered held until a hearing Monday. He faces a maximum sentence of life in prison on the weapon-of-mass-destruction charge and 20 years on the attempted-murder charge.

Martinez told an FBI informant he thought about nothing but jihad, according to court documents. He wasn't deterred even after a Somalia-born teenager was arrested in Portland, Ore., the day after Thanksgiving in an FBI sting.

The Oregon suspect, Mohamed O. Mohamud, intended to bomb a crowded downtown Christmas tree-lighting ceremony, but the people he had been communicating with about the plot were FBI agents.

Martinez wondered briefly if he was headed down a similar path, documents indicate. "I'm not falling for no b.s.," he told the FBI informant when he heard about the Oregon case. He said he still wanted to go ahead, but the informant told him to think about it overnight.

In the following days, Martinez reiterated his support for the plan several times, documents show, saying at one point: "I came to you about this, brother." The FBI stressed that Martinez acted alone and that the idea to blow up the military recruitment center was his, not the FBI's.

Public defender Joseph Balter cautioned against a rush to judgment. "It's very, very early in this case," he said.