Ahmad Wali Siddiqui, who is accused of training with those terrorist groups in Pakistan, looked relaxed as his trial opened in the western city of Koblenz on Monday.
“We wanted to fight ... against Americans,” Siddiqui told the court in a lengthy statement.
He said he expected to go to war against U.S. forces in Afghanistan after undergoing his training in Pakistan.
No pleas are entered under the German system and Siddiqui did not immediately address the charges against him, telling the court about his upbringing and how he immigrated to Germany as a teenager.
The 37-year-old was captured by U.S. troops in Afghanistan in July 2010 and while in custody provided details on alleged al-Qaida plots supposedly targeting European cities. No attacks materialized.
He is accused of membership in al-Qaida and the Islamic Movement of Uzbekistan and faces a possible 10 years in prison if convicted.
Authorities say he was one of about a dozen radical Muslims who left the northern German port city of Hamburg in 2009 to pursue terrorist training aiming at taking part in jihad, or holy war. Several of them have been captured or killed.
Another member of the group, German-Syrian dual national Rami Makanesi, was convicted last year in a Frankfurt state court of membership in al-Qaida and sentenced to four years and nine months.
Before going to Pakistan, Siddiqui and several other suspects met at Hamburg's al-Quds mosque, the prayer house that had also served as a gathering point for some of the Sept. 11 attackers before they moved to the U.S. to attend flight schools in 2000, German intelligence officials have said. The mosque has now been shut down by authorities.
Intelligence officials also said Siddiqui was a friend of Mounir el Motassadeq, who was convicted by a German court in 2006 of being an accessory to the murder of the 246 passengers and crew on the four jetliners used in the Sept. 11 terrorist attacks. El Motassadeq also frequented the al-Quds mosque.
“He wasn't my friend,” Siddiqui told the Koblenz court. He said they first met when they both worked for the same aviation services company for several months.
Despite distancing himself from El Motassadeq, Siddiqui acknowledged that he drove El Motassadeq's father 400 kilometers (250 miles) to the western German city of Wuppertal in 2002 to visit his son in a prison there.
Siddiqui also said he did not personally know Sept. 11 plotter Ramzi Binalshibh and suicide hijacker Mohamed Atta, who had both lived in Hamburg.
Prosecutors maintain Siddiqui received general military training at a camp run by the Islamic Movement of Uzbekistan and helped produce a German-language propaganda film that was shown during the trial Monday.
In the summer of 2009, he decided to leave the group's camp, and moved to an al-Qaida training area where he learned how to use heavy weapons, including anti-tank weapons and mortars, prosecutors said.
In June 2010, a “high-ranking al-Qaida member” told Siddiqui to return to Germany to become part of a European network of the terrorist organization, prosecutors said.
“The network was supposed to secure financial support for the organization, but at the same time be ready for other, not yet concrete, orders from the al-Qaida leadership,” the statement said.
The German magazine Der Spiegel, which obtained the full 114-page indictment, identified the al-Qaida leader behind the orders as Younis al-Mauritani, who was apprehended in 2011 by Pakistani agents working with the CIA.
After receiving his orders, prosecutors said Siddiqui slipped across the border into Afghanistan to return from there to Germany, but was captured by American troops in Kabul.
Intelligence officials say he provided American interrogators with details of an early terrorist plot in Europe around Christmas 2010, which led the U.S. and others to issue a travel alert for Europe.
He was turned over to German authorities last April.