A German court has quashed the world's only conviction over the 11 September 2001 attacks in the US.
Motassadek is likely to remain in custody until the new trial
Mounir al-Motassadek was jailed as an accessory to more than 3,000 murders, and for membership of the Hamburg al-Qaeda cell behind the attacks.
But on Thursday Germany's Federal Criminal Court threw out the verdict and ordered a fresh trial.
A second Moroccan, Abdelghani Mzoudi, was cleared in Germany last month on similar charges.
Mr Motassadek, 29, had been serving a 15-year sentence.
But the presiding judge said the evidence against him had not been sufficient for a conviction.
"The fight against terrorism cannot be a wild, unjust war,"
Klaus Tolksdorf said.
"A conflict between the security interests of the executive and
the rights to defence of the accused cannot be resolved to the
disadvantage of the accused."
He added that although Mr Motassadek was "far from being beyond suspicion", but had a right to a new trial if legal standards were below those he expected.
Abdelghani Mzoudi was released from custody in December
"We are announcing a verdict here that we do not expect will be
greeted with complete agreement," the judge said.
German Interior Minister Otto Schily said the decision was "regrettable" but noted that Mr Motassadek had not been acquitted and would be prosecuted again.
A lawyer representing American relatives of victims, Andreas Schulz, said the verdict "will surely meet with incomprehension on the part of the families".
Mr Motassadek was not in court to hear Thursday's ruling, and is
expected to remain in custody pending the new trial.
The BBC's Ray Furlong in Germany says the latest acquittal will come as a blow to prosecutors, and could jeopardise other cases involving alleged al-Qaeda members.
Pressure on US
A Hamburg court found him guilty last year of being a member of the cell which supplied three of the suicide hijackers who carried out the 11 September attacks.
The evidence Mr Motassadek's lawyers used to win him a retrial was supplied by German investigators in the case of Abdelghani Mzoudi last month.
The source was acknowledged in court to be Ramzi Binalshibh, a senior al-Qaeda suspect now in US custody, but this has not been made official.
Our correspondent says there will now be increased pressure on the United States to reverse a decision to withhold full transcripts of Mr Binalshibh's interrogation.
Is the world doing enough to cooperate in combating terrorism?
The following comments reflect the balance of opinion we have received:
International politics and conflicting interests of the 5 superpowers is shaping our world in a way that suits them. There are no more rules. What one nation calls terrorism is what another calls resistance force.
Sam Osunsoko, Lagos, Nigeria
The best way to combat terrorism would be to spend more energy on finding out the reasons people resort to such measures and addressing the problems honestly. Less effective, is waiting for something to happen then hunt then down. The latter approach only serves political ambitions of dishonest leaders
Chris Kilala, Amsterdam, The Netherlands
Among first world nations it is not only important to cooperate militarily, but also to ensure fair and equal treatment of those accused of aiding and abetting terrorist organizations. To do otherwise simply ensures a fresh generation of terrorists will replace those already killed and captured. We can only win this war by winning the hearts and minds of our enemies.
Chris Whiting, Calgary Canada
The world is trying hard enough but the circle of terrorism is so vast that it's very difficult to eradicate the threat. Terrorists are stationed all over the world, such a threat is so difficult to get rid. I believe that the authorities have and are doing the best they can to combat the problem as progress is gradually been made.
Will Boarland, Paris, France
If we let our governments hold or convict individuals without a complete and open trial, each and every one of us will lose part or all of our freedom.
Harry Pratt, United State
The European nations do not understand that they are in a battle for their very mind and will. It is we who have had the clearer view for the last 200+ years. It's not about power or money or oil or the media. It's about intervention. Without intervention nothing changes it only gets worse.
David File, Huntington Beach, CA, USA
At least Germany is actually taking people to trial and following good legal practice. If only the US would do the same for those at Guantanamo.
Ted, New York, USA
No, I do not believe that everyone is doing enough to cooperate in the fight against terrorism. I believe that if it had happened to any other country in the world, the rest of the world would be more eager to aid that country. The USA would also be there to aid them.
Kim, Monticello, USA
I think the Europeans are doing far too little to curb terrorism. I suppose they would have a greater sense of urgency if they had major buildings destroyed and thousands killed and serious disruptions to their economies.
Charles Oppitz, Redding, Ca USA