Six Tunisian fishermen arrested earlier this month by Italian authorities for “aiding illegal migrants” have been cleared.
One of the men’s lawyers and their fishermen’s association confirmed the acquittal to the BBC.
The arrests outraged Tunisian fishermen and activists who demanded their release.
Supporters of the fishermen, from the south-east coastal town of Zarzis, said the men were aiding a boat in distress.
The struggling vessel with 14 people on board was trying to reach the Italian island of Lampedusa.
Italy’s new populist government has taken a hard line on migration.
The country is the main point of entry for Africans coming to Europe by sea, but wants the burden of migrant arrivals to be shared among EU states.
One of the passengers on the boat told the BBC they were “floating in the middle of the sea” after their engine died.
The fishermen initially tried to persuade them to return to Tunisia, before towing them closer to Italy where the coastguard could find them.
It was there the fishermen were arrested.
Speaking to the BBC, the secretary of the Association of Fishermen in Zarzis, Anis Alsouei, said the judge had now ordered the men’s release.
“We are very happy with the ruling,” he said, adding that the arrests “will not stop our fishermen from saving people’s lives at sea and help them to get to the nearest port when their lives are at risk.”
One of the arrested fishermen is Chamseddine Bourassine, president of the Association of Fishermen in Zarzis.
He is a local legend in the town, reports the BBC’s Rana Jawad in Tunis.
His lawyer, Salvatore Cusumano, told the BBC the men are awaiting their release in Palermo.
“If everything goes OK they can even go home tonight,” he said.
Under EU rules, people must seek asylum where they arrive, but Italy has increasingly barred boats from docking at its ports.