Judge Fernando Grande-Marlaska charged the men with conspiring to use a 500 kilogram truck bomb on the court building, hoping to obliterate evidence against fellow Islamic extremists.
Algerian suspect Mohamed Achraf, extradited from Switzerland to Spain in April last April, is accused of allegedly being the mastermind behind the plan to bomb the court, which hears terror cases.
Most of the alleged plotters are Algerians but there are others from Morocco, Mauritania, Afghanistan, Lebanon and Spain. They allegedly wanted "to kill people inside" the court according to the charges.
The suspects called themselves "Martyrs for Morocco" and allegedly intended to destroy archives concerning their "brothers in arms," the judge charged.
He was referring to those accused of the March 11, 2004 Madrid train bombings, which killed 191 people.
Judge Grande-Marlaska charged the men with planning terrorist attacks, including the court building plot, and falsification of public and official documents for terrorist ends.
The suspects belong to a group which "defends the practice of Jihad (holy war) and aims to employ it in Spain, through violent actions such as the one that targeted the supreme court building" in Madrid, according to the charges.
Some of the men are believed to be members of an Algerian Salafist cell.
Most of the accused were arrested between October and November 2004 on the orders of anti-terrorist high court judge Baltasar Garzon.
The judge claimed that Mohamed Achraf set up the "Martyrs for Morocco" three years ago while languishing in a Spanish jail for forging credit cards.
Several of the accused were alleged to have been recruited while serving prison terms.
