Judge Clementina Forleo said on Monday that the five were guerrillas, not terrorists - a ruling that drew a fierce government reaction.
All five had been charged with sending fighters to Iraq and planning attacks in Europe, but the judge said there was no evidence to back up the accusations.
Forleo added that there was no evidence the four Tunisians and Moroccan were involved in anything beyond what might be considered "guerrilla" activities.
Jail terms given
The judge sentenced Abu Yahya Mahir and Ali Bin Sassi Tumi to three years and Muhammad Daki to 22 months in jail for trading forged documents, far less than the prison terms of up to 10 years that prosecutors had sought.
She referred Idris Nur al-Din and Kamal Hamrawi to another court because of a question of regional jurisdiction.
"Historically, the activity of the cells in question coincided with the United States' attack on Iraq," the statement explaining her judgment said.
"Numerous intercepted conversations refer to that event, and to the need to stem as much as possible its foreseeable negative impact by helping the brothers in the conflict zone, either economically or by sending combatants to strengthen their armed groups.
"It has not been proven that these paramilitary structures provided for concrete programmes with targets exceeding guerrilla activity," the document added.
Italian Foreign Minister Gianfranco Fini said the judge's ruling was a "shameless distortion of a reality that is under the eyes of the entire world".
"To say in the ruling that 'in the conflict in question all armed actors have used instruments with an extremely high offensive potential' means you are placing the victims and the butchers on the same level," Fini said in a statement.
The five men had been charged with "subversive association for international terrorism" under a law Italy introduced after the 9/11 attacks, when governments around the world tightened their anti-terrorist legislation.
The judge said much of the evidence submitted was of very poor quality and relied on intelligence reports rather than hard evidence.