NEW YORK – A New York man said Friday that a plan to attack the city subway system was ordered by al-Qaida leaders two years ago while he was in Pakistan with a friend, a former airport shuttle driver who has admitted to building the homemade explosives in the plot.

Zarein Ahmedzay, 25, pleaded guilty in federal court in Brooklyn to charges that included conspiracy to use weapons of mass destruction in the foiled subway bomb plot from fall 2009.

Ahmedzay said he, admitted plotter Najibullah Zazi and a third, unidentified man met in summer 2008 with the terror group’s leaders in Pakistan, where they offered to join the Taliban and fight U.S. forces in Afghanistan.

“They told us we would be more useful if we returned to New York City to conduct operations,” Ahmedzay said. Asked by the judge what kind of operations, he responded, “Suicide-bombing operations.”

“I personally believed that conducting an operation in the United States would be the best way to end the war,” he said.

Assistant U.S. Attorney Jeffrey Knox identified the leaders as senior al-Qaida operatives Saleh al-Somali and Rashid Rauf, who were later killed by Predator drone strikes in Pakistan. The U.S. Justice Department described al-Somali as the head of international operations for al-Qaida.

Prosecutors say Ahmedzay joined Zazi and another friend from their Queens high school on the trip to Pakistan to seek terrorism training.

Zazi, a Colorado airport van driver, admitted this year that he tested bomb-making materials in a Denver suburb before traveling by car to New York with the intent of attacking the subway system to avenge U.S. military involvement in Afghanistan.

Ahmedzay and the third suspect, Adis Medunjanin, had previously pleaded not guilty to charges they sought to join Zazi in what prosecutors described as three “coordinated suicide bombing attacks” on Manhattan subway lines. Medunjanin attorney Robert Gottlieb said Friday his client intended to go to trial.

Officials have said a fourth suspect is in custody in Pakistan, but they have given no other details about him.

Ahmedzay — who had been licensed to drive a taxi in New York — said Friday that al-Qaida leadership encouraged the men to target “well-known structures” in New York to cause “maximum casualties.” He said they also decided that the attack should occur during the Muslim holy month of Ramadan, between Aug. 22 and Sept. 20.

Prosecutors said the three settled on the subways after Zazi determined he could only make enough explosives for a smaller-scale attack in time for Ramadan, and decided it would happen Sept. 14, 15 or 16.

During his plea, he urged Americans to “stop supporting the war against Islam.”

“I’m thankful for myself that I didn’t harm anyone, but I feel someone else will do the same thing,” he said.

The New York plot was disrupted in early September when police officials stopped Zazi’s car as it entered New York.

Ahmedzay faces a possible life term at sentencing July 30.