New York (CNN) -- A confessed terror plotter calmly told a jury how he acquired the ingredients to make the bombs that he and his co-conspirators planned to detonate on New York subway trains during rush hour, killing many.
If the attack was against the United States, then it was "moral," Najibullah Zazi said Wednesday during his second day of testimony in federal court in New York.
Zazi, the mastermind behind a plot to rig backpacks with explosives and blow them up on trains, is testifying this week against Adis Medunjanin, the only member of the trio on trial.
During his testimony, Zazi detailed how he bought the chemicals from beauty shops and other ingredients from Walmart and Lowe's and then searched for crowded areas to detonate the explosives.
Zazi, an immigrant from Pakistan, and Zarein Ahmedzay, an immigrant from Afghanistan, have already pleaded guilty to terror charges.
Zazi said the group was trained in Pakistan by al Qaeda in 2008 and 2009 and then returned to the United States with instructions to attack.
The group decided to detonate three bombs on a busy subway train during the Muslim holy month of Ramadan, also around the anniversary of the 9/11 attacks, Zazi said. He testified that one of his al Qaeda handlers told them the attack should send a message to incoming President Barack Obama to pull American troops from Afghanistan.
But e-mails monitored by authorities may have helped to foil the plot.
Prosecutors in court showed several e-mails they say that Zazi sent in which he asks a person in al Qaeda about a formula for a bomb.
During cross examination, Robert Gottlieb, Medunjanin's attorney, tried to show that his client had had a falling out with Zazi before the plot was created.
Medunjanin's trial is expected to last three weeks.
Authorities widely regard the plot as the most serious al Qaeda attempt to launch an attack on American soil since 9/11.
CNN's Kiran Khalid and CNN terrorism analyst Paul Cruickshank contributed to this report.