A Baltimore man has been arrested and charged in an alleged plot to bomb a military recruiting center in suburban Maryland, federal officials said.

Antonio Martinez, also known as Muhammad Hussain, was charged with attempting to murder federal officers and employees and attempted use of a weapon of mass destruction against federal property in a scheme to attack an Armed Forces recruiting station in Catonsville, Md., a Baltimore suburb, U.S. District Attorney for Maryland Rod J. Rosenstein, and Richard A. McFeely, special agent in charge of the FBI's Baltimore division, said in a joint statement.

Martinez was taken into custody after he was observed inspecting the bomb's components in the back of a vehicle just prior to his attempt to detonate the device by remote in the recruiting center's parking lot, the statement said. The device was inert and was supplied to the would-be bomber by an undercover FBI informant, the statement said.

 Rosenstein said the public was never in harm's way "because the people Mister Martinez asked to help carry out his attack actually were working with the FBI."

The work of the Joint Terrorism Task Force, which led to the discovery of the alleged crime, "showed us Martinez was absolutely committed to carrying out an attack which would have cost lives," McFeely added.

Martinez allegedly began plotting the bombing with undercover agents in September, after authorities were alerted to Martinez's Facebook page, on which he had posted a message that said he hates people who oppose Allah and his prophet.

Martinez faces a maximum sentence of 20 years in prison for attempting to murder federal officers and employees and life in prison for attempted use of a weapon of mass destruction against federal property, officials said.