NEW YORK — The high-profile trial began Monday of a man accused of being part of a New York trio that was only "days" from bombing the city's crowded subway to take revenge for the US war in Afghanistan.

The trial in Brooklyn features quintessential New York immigrant Muslims who became radicalized in the feverish post-9/11 atmosphere and allegedly became homegrown terrorists with a plan to cause carnage in America's biggest city.

Federal prosecutor James Loonam opened by pointing across the courtroom at defendant Adis Medunjanin, 27, and calling him an Al-Qaeda "terrorist."

Loonam detailed how in September 2009 Medunjanin, along with two former New York high school friends, put final touches on a plan to bomb either the subway, Times Square, or another packed location.

"Three men were prepared to strap bombs to their bodies and walk into crowded New York subway cars that were filled with innocent people," Loonam said. "These men came so close, within days of carrying out this attack, before they were stopped."

Gesturing at Medunjanin, who wore a suit, the prosecutor said: "One of those Al-Qaeda terrorists is inside the courtroom right now."

Medunjanin, a Bosnian whose family fled to the United States during the war with Serbia in the 1990s, is charged with nine terrorism-related counts.

He is accused of traveling to Pakistan in a failed attempt to join the Taliban to fight against US forces in Afghanistan, entering the bomb plot on his return home, and finally trying to use his car to cause bloodshed in a desperate last act before his arrest.

He has pleaded not guilty. His lawyer, Robert Gottlieb, said Medunjanin was only a passionate Muslim who wanted to go to Afghanistan because he was outraged by the US drone bombing of civilians and abuses in US military prisons.

"The truth is Adis Medunjanin is not a terrorist. The truth is, in this case, the government with all its inflammatory and incendiary allegations, is just wrong," Gottlieb said.

"Mr Medunjanin never planned to bomb the New York City subways, contrary to what the government has told you. Mr Medunjanin never joined any plan, as that term is defined in the law... to go to Afghanistan to kill members of the United States military."

The other two men in the alleged plot, Najibullah Zazi and Zarein Ahmedzay, have already pleaded guilty and are turning on their old friend in hopes that cooperation with prosecutors will earn them lighter sentences.

Ahmedzay was the first witness called by the prosecution. Zazi, described as the ringleader of the alleged plot, was due to take the stand Tuesday.

Medunjanin could face life in prison if found guilty on all counts.

The trial will expose the inner workings of America's radicalized Muslim youth in an era of continuous, controversial wars in Iraq and Afghanistan and what many civil rights defenders describe as anti-Islamic discrimination at home.

The alleged plot is said by prosecutors to have been coordinated with al-Qaeda operatives during a trip to Pakistan in 2008.

The three friends were in many ways typical New Yorkers, striving to live the immigrant dream. Medunjanin was a doorman, Ahmedzay drove a yellow cab, and Zazi was a coffee cart vendor before moving to Colorado, where he drove an airport shuttle bus.

Gottlieb said prosecutors were fear mongering to make Medunjanin sound like a monster, to "scare you to your core" and "create an atmosphere and environment in this courtroom that could prevent you from seeing the truth about this case."

Gottlieb said Medunjanin did not intend to hurt his adopted country, but did hope to support the Taliban guerrillas.

"They decided they had to go to Afghanistan. They had to join the Taliban to defend Muslims."

But Loonam said the defendant and his two former friends were eager recruits to the al-Qaeda cause and seen as prized assets.

"They were potentially very valuable to them. They had American passports," he said. "This meant these men could return to the United States undetected."

Back on US soil, Zazi went about assembling bomb parts, telling his al-Qaeda contact: "The marriage is ready."

The trial could take about three weeks, Judge John Gleeson said.