Tunisian Lassad Briki, 35, and Pakistan national Muhammad Baqas, 27, will be deported after serving their sentences, the judge said after agreeing to the maximum sanction requested by prosecutors.
The two men were arrested in July 2015 in Brescia in northern Italy on suspicion of setting up a Twitter account from which they posted messages threatening to attack iconic Italian monuments like Milan's Duomo and the Colosseum in Rome.
The threats were accompanied by photos of the monuments and written in Italian, French and Arabic.
“We are on your streets, we are everywhere,” one post read. “We are identifying the targets and await the X hour.”
The sentences were handed down despite the prosecutor in charge of the investigation saying at the time of the arrests that “there was no sign of even the beginning of a move (beyond words) to action.”
The two men had, however, downloaded an online “manual” which covered the production of home-made explosives, carrying weapons and operating clandestinely on the internet.