An Italian court on Wednesday refused to extradite a Moroccan man suspected of having supplied weapons for the attack on the Bardo Museum in Tunisia earlier this year because he might face the death penalty in the case.

Italy refuses to extradite suspects to any country if there is a risk they could be executed for the crime.

Separately, Milan prosecutors asked that the investigation into Abdelmajid Touil's alleged connection to the March 18 attack in Tunis -- in which 21 tourists were shot dead -- be dropped for lack of evidence, judicial sources said.

"The most serious crimes the accused faces are punished by death according to the Tunisian penal code," said Giovanni Canzio, the president of the Milan court of appeals. "Capital punishment impedes extradition because it is not foreseen by Italian law."

Tunisia had not given Italy any guarantee that Touil would not face the death penalty, Canzio said and ordered the release of the Moroccan after more than five months in custody.

There was no immediate comment from Tunisia.

A Tunisian government official said Touil had supplied arms to the militants prior to the attack and then boarded a boat for Italy.

His case fuelled fears that Islamist militants could be among the hundreds of thousands of migrants who have crossed the Mediterranean by boat to enter Europe in the past two years.