Rami Makenesi provided a full confession in exchange for a reduced prison sentence of no more than five years.
The Frankfurt-born Makenesi went to Pakistan in 2009 where he joined an al-Qaida group which gave him weapons' training. He was also involved in fighting Pakistani troops, the court heard.
In February 2010 he was sent to join a group fighting in Afghanistan, but was unable to keep pace with the rebels and had to turn back.
Instead he offered to help raise funds for the group in Germany, but was arrested by Pakistani authorities in June before he could make it home.
He was extradited to Germany in August where he has been held pending trial.
Information provided by him and by another German arrested in Afghanistan prompted a security clampdown in Germany in November, resulting notably in the closing of the federal parliament building in Berlin to most visitors.