An Italian judge has ordered that a Tunisian convicted of criminal association with the aim of terrorism be freed, citing time served at Guantanamo.

Adel Ben Mabrouk was transferred to Italy in November 2009 as part of the United States' bid to shut down the prison.

Mabrouk's defense lawyer, Giuseppina Regina, said she and prosecutors made a joint appeal to the judge to take into consideration the nine years Mabrouk spent in Guantanamo in "inhumane conditions."

The judge on Monday convicted Mabrouk of terrorist association, handing him a two-year suspended sentence. He must legally be freed by midnight.

Regina says Mabrouk has no passport, and his plans are yet unknown.