New York (CNN) -- Terrorism suspect Najibullah Zazi pleaded guilty Monday to conspiring to detonate explosives in the United States.
In an appearance before a federal judge, Zazi, a native of Afghanistan who lived in Colorado, admitted his role in the conspiracy, saying, "In spring 2008, I conspired with others to join the Taliban, to fight along with the Taliban against the United States."
"We were recruited to al Qaeda instead," he said.
He pleaded guilty to three counts: conspiring to use weapons of mass destruction, conspiracy to commit murder in a foreign country and providing material support to a terrorist organization.
The terms of the plea deal were sealed. A law enforcement source told CNN that the threat of legal action against Zazi's associates and family played a role in his decision to cooperate with the government. The source said Zazi's parents faced potential immigration fraud charges. They were not facing deportation but did face the possibility of criminal penalties.
Sentencing is set for June 25. Zazi faces a maximum sentence of life in prison for the first two counts and an additional 15 years in prison for the third count, the Justice Department said in a news release announcing the plea.
Zazi was arrested in September in an alleged plot to build and detonate bombs in New York around the anniversary of the September 11, 2001, terrorist attacks.
While at a terrorist training camp in northwest Pakistan's Waziristan region along the Afghan border, he "had discussions with al Qaeda about targets including the New York City subway system," Zazi said in court Monday.
He said he learned how to make explosives at the camp and e-mailed himself bomb-making instructions to use once he returned to the United States.
"In early September 2009, I drove to New York with materials to build bombs," he said.
"This attempted attack on our homeland was real," U.S. Attorney General Eric Holder said at a news conference praising the criminal justice system in foiling the plot. "It was in motion, and it would have been deadly."
He said "there is no doubt that American lives were saved" as a result of the investigation, adding that the case is "further evidence that al Qaeda continues to plan attacks on the United States."
Federal officials have said the conspiracy involving Zazi represents the most serious terrorism plot since 9/11, and the investigation is intense and ongoing.
Since Zazi's arrest last year, two of his acquaintances have been indicted in the case, as well as Zazi's father and uncle.
Zazi's father, Mohammed Wali Zazi, initially was charged with lying to investigators, but in January a federal grand jury in New York charged him with conspiracy to obstruct justice by helping to discard bomb-making chemicals when he learned of the government's investigation.
Najibullah Zazi's uncle, Naqib Jaji, was indicted on a single felony charge and was arraigned in a sealed proceeding in Brooklyn, New York, in January. The charge wasn't specified, but a source said the uncle participated in the attempt to dispose of evidence.
The indictment against Zazi said he twice checked into a motel in the Denver, Colorado, area -- in August and September -- and was experimenting with heating chemicals that could create a bomb. The indictment said chemical residues had been recovered from a vent in the motel room.
CNN obtained closed-circuit video from beauty parlors in the area that authorities said showed Zazi buying large quantities of chemicals that can be used to make bombs. The indictment against the younger Zazi said he was also in contact with other people as he experimented with the chemicals and tried to make the high explosive TATP.
He took several trips to New York for planning purposes, Zazi said, before making the final trip September 10 to carry out the plot.
Authorities have said Zazi had been under surveillance for months before his arrest September 19. Agents had followed him as he drove from Denver to New York.
"The plan was to use materials in the subway once the bomb was ready," Zazi said Monday. Instead, he and his co-conspirators realized they were being investigated, and they threw away the materials, he said.
Authorities said Zazi planned to be in New York with the intent of using an explosive device around September 11, 2009. The alleged plot, which came to light after raids in New York in mid-September, may have been targeting a major transportation center, sources said earlier.
The other men indicted in connection with the case are Zarein Ahmedzay, a New York taxi driver, accused of lying to the FBI, and Adis Medunjanin, 25, originally from Bosnia.
Medunjanin has pleaded not guilty to charges of conspiracy to commit murder in a foreign country and receiving military-type training from al Qaeda.
Ahmedzay pleaded not guilty to lying to special agents about locations he visited during a trip to Pakistan and Afghanistan and about discussions he had with an unidentified man about military training in Pakistan in 2008.
At Monday's news conference, Holder used Zazi's plea and the foiling of the conspiracy to defend the U.S. criminal justice system, which has been under fire after a Nigerian man allegedly tried to detonate a device aboard a flight from the Netherlands to Detroit, Michigan, on Christmas Day. The man, Umar Farouk AbdulMutallab, is being tried in civilian court. Republican leaders have said that AbdulMutallab should be treated as an enemy combatant and tried in a military tribunal.
"We are at war against a very dangerous and intelligent and adaptable enemy, and we must use every weapon available to us in order to win that war," Holder said. "In [the Zazi] case ... the criminal justice system has proved to be an invaluable weapon for discovering plots and incapacitating terrorists. ... We'll continue to use it to protect the American people from terrorism."
CNN's Drew Griffin, Kathleen Johnston, Tim Lister and Jeanne Meserve contributed to this report.