Story highlights A preliminary hearing in the case is scheduled for Wednesday

Suspect Amine El Khalifi is charged with attempting to use a weapon of mass destruction

El Khalifi, an immigrant from Morocco, is in the United States illegally

The explosives and firearm he allegedly sought had been rendered inoperable

A 29-year-old man from Morocco was arrested Friday and charged with attempting to bomb the U.S. Capitol building in a suicide attack, authorities said.

Suspect Amine El Khalifi made an initial appearance in court and, if convicted, faces a maximum penalty of life in prison, according to the Justice Department.

He allegedly went to a parking garage near the Capitol on Friday and received what he thought was a vest with explosives and a firearm, both of which had been rendered inoperable by law enforcement. He was arrested before leaving the garage.

"Today's case underscores the continuing threat we face from homegrown violent extremists," said Assistant Attorney General for National Security Lisa Monaco. "Thanks to a coordinated law enforcement effort, El Khalifi's alleged plot was thwarted before anyone was harmed."

The suspect was charged with attempting to use a weapon of mass destruction against government property. Authorities say the public was never in any danger.

As news of the arrest broke, the Senate had just wrapped up voting on a payroll tax cut extension deal. The House of Representatives had already voted on the deal and members had left, or were leaving. Tourists were also at the Capitol, as is usual.

During his initial court appearance, El Khalifi wore blue pants and a green T-shirt with the words "Ready in Season" on the back. He had short black hair, a trimmed, thin beard and tattoos on his inner arm. He stood straight, showed no emotion and did not speak.

A preliminary hearing in the case is scheduled for Wednesday.

JUST WATCHED Source: Man tries to attack U.S. Capitol Replay More Videos ... MUST WATCH Source: Man tries to attack U.S. Capitol 02:18

The suspect, an immigrant from Morocco, is in the United States illegally. He had been closely monitored as part of a lengthy and extensive undercover operation, police said, adding that U.S. Capitol Police had been "intimately" involved in the investigation.

The suspect entered the United States in June 1999 on a B2 visa -- which allows for trips for pleasure, tourism or medical treatment, according to an FBI affidavit. His visa expired that same year and he has been living in the United States illegally ever since.

In January 2011, a confidential source reported to the FBI that El Khalifi met with other individuals at a residence in Arlington, Virginia. A person there produced what appeared to be weapons and El Khalifi "expressed agreement with a statement by this individual that the 'war on terrorism' was a 'war on Muslim,' and said that the group needed to be ready for war," the affidavit read.

At another point, El Khalifi allegedly said he would "be happy killing 30 people," it said.

One law enforcement official, who spoke on the condition of anonymity, told CNN that authorities are searching two locations in Virginia in connection to the investigation -- one in Arlington, the other in Alexandria.

A second law enforcement official said El Khalifi is not connected to a terrorist organization and was acting alone.

El Khalifi thought he had met al Qaeda members who would assist him, but in fact he was dealing with undercover FBI agents, said the second source, who declined to say whether the FBI has audio or video recordings of the suspect talking to undercover agents about his plans.

A third source briefed on the matter said the suspect was identified through an existing criminal, not terrorism investigation. When asked about possible entrapment, the U.S. government source said the suspect went out on his own to buy component pieces for an improvised explosive device.

After news of the arrest broke, House Majority Leader Eric Cantor hailed the work of the FBI and the U.S. Capitol Police in thwarting the alleged attack.

"These brave members of our law enforcement community make daily sacrifices in their work to keep us safe and deserve tremendous credit for their efforts leading up to today's successful sting," he said.

President Barack Obama was informed on Thursday about the FBI's plan to arrest El Khalifi, a White House spokesman said.

Top congressional leaders were also briefed on the arrest and operation, a congressional source said, though it was not clear exactly when.

Unlike some other recent attacks on the Capitol, Friday's alleged suicide plot involved a suspect willing to kill himself.

In September last year, a federal grand jury indicted a man for allegedly plotting to use large remote-controlled model airplanes filled with explosives to attack the Capitol and the Pentagon.

A man was arrested in September 2008 two blocks from the Capitol after an officer spotted a rifle in his car.

And in July 1998, a gunman fired shots in the Capitol building, killing two U.S. Capitol Police officers.