The "Düsseldorf cell", named after the city in North Rhine-Westphalia where three of the men lived, had planned the attack but not yet decided on a target, the court found.
The ring leader, Moroccan national Abdeladim el-Kebir, 33, was sentenced to nine years in jail for planning the attack and being a member of a terrorist group.
Prosecutors said Kebir had received orders from a senior al-Qaeda operative while at a weapons training camp on the border between Afghanistan and Pakistan.
German police started monitoring his movements in early 2010 following a tip-off based on US intelligence, German media have reported.
Police arrested three of the men in April 2011 in Düsseldorf and the fourth in December in Bochum after months of surveillance.
Within weeks of the April arrests, US Navy Seals shot dead al-Qaeda leader Osama bin Laden in Pakistan and took away communications material, some of which further implicated the German group, media reports have said.
Prosecutors said the four men had been experimenting to build a bomb, which they hoped to detonate in a large crowd, to be followed by a second explosive device when emergency services arrived on the scene.
German-Moroccan national Jamil Seddiki, 34, received seven years and German-Iranian Amid Chaabi, 23, five and a half, also for membership in a terrorist group.
German Halil Simsek, 30, received a four and a half year prison term for supporting a terrorist group, at the end of the trial that lasted more than two years.