Dasbar W. was arrested in December 2017 for allegedly planning to drive into crowds at an ice rink in Karlsruhe.
The court found insufficient proof to convict him for the alleged plot, but handed Dasbar W. five and a half years in jail for his links with the IS group.
Born in Germany, Dasbar W. moved with his parents to their home country of Iraq in 2006.
He returned to Germany in 2014 and a year later made contact in online chat groups with other IS sympathisers.
He travelled back to Iraq in June 2015 and began acting as a middleman between a high-ranking IS member and a prominent imam in Erbil.
(article continues below)
See also on The Local:
Prosecutors said he returned to Germany after receiving an order from the IS contact to carry out an attack — but he failed to execute the task as two French students sharing an apartment with him warned the police.
The defendant then went back again to Erbil and spied on the prime minister's office as a potential target of attack.
He was caught and jailed for two months in Iraq.
Several months after his release, he returned once more to Germany in July
Dasbar W.'s arrest in December 2017 came a year after a Christmas market attack in Berlin that killed 12 people.
Rejected asylum seeker Anis Amri, a Tunisian, ploughed a truck into the market on December 19, 2016 before being shot dead while on the run days later in Italy.