An airport shuttle driver from Colorado accused of allegedly hatching a diabolical plot to detonate homemade bombs inside the city’s subway system pleaded guilty this afternoon to terrorism charges.

Najibullah Zazi, 25, entered the plea deal after agreeing to cooperate with federal prosecutors in the Brooklyn US Attorney’s office.

The Afghan native — wearing a dark-blue prison jump suit and sporting a beard — told Judge Raymond Dearie in Brooklyn federal court that he planned a “martyrdom operation in Manhattan” and that he was recruited by al Qaeda to carry out the attack.

“To me it meant that I would sacrifice myself to bring attention to what the US military was doing to civilians in Afghanistan,” he said.

The feds claim Zazi drove to New York from Denver last September with the intent to detonate weapons of mass destruction in the city.

Zazi faces a life prison sentence without parole after pleading guilty to conspiracy to use weapons of mass destruction, conspiracy to commit murder in a foreign country and providing material support to a foreign terror organization.

US Attorney General Eric Holder has called the plot one of the most serious terror threats ever hatched on US soil since the 9/11 attacks on the World Trade Center and the Pentagon.

Zazi, who will be sentenced on June 25, is currently housed in solitary confinement inside the Metropolitan Detention Center in Brooklyn.

His lawyer William Stampur told reporters that “the plea speaks for itself” and would not elaborate.

Zazi had previously pleaded not guilty to the charges after he was indicted by a federal grand jury.

Prosecutors allege that Zazi learned to make explosives at an al Qaeda camp in Pakistan’s Waziristan region, which borders Afghanistan.

They also claim Zazi had bomb-making notes on his computer and purchased chemicals to pull off the attack, which was to have been similar to the 2005 London subway bombings.