A tanker that was hijacked by migrants off Libya docked in Malta on Thursday after the Maltese armed forces took control of the vessel.
The Palau-flagged tanker Elhiblu I had picked up the 108 migrants including women and children on Tuesday evening and then headed back to Tripoli.
But six nautical miles from port the ship suddenly changed course and headed north toward Europe.
Italy's far-right Interior Minister Matteo Salvini said Wednesday the vessel had been hijacked and vowed that the migrants would not be allowed to disembark in Italy.
The 52-metre (170-foot) tanker was about 30 nautical miles from Malta when the Armed Forces of Malta (AFM) established communications with the captain.
"The captain repeatedly stated that he was not in control of the vessel and that he and his crew were being forced and threatened by a number of migrants to proceed to Malta," the AFM said in a statement on Thursday morning.
"AFM Patrol Vessel P21 stopped the tanker from entering the Maltese territorial waters.
"An AFM Special Operations Unit team was dispatched to board and secure the vessel in order to hand over control of the ship to the captain."
It said the team was backed up by several naval vessels and a helicopter.
Escorted by the Maltese navy, the tanker arrived in the port of Valetta around 8:30am (0730 GMT), where the AFM said it would "be handed over to the police for further investigations".
'People are very upset'
The German charity Sea-Eye, whose ship Alan Kurdi was in the rescue zone off Libya, said it had overheard radio messages between a European military aircraft and the captain of the tanker, both before and after the hijacking.
"The captain of the ship rescued the people and requested assistance. He said unequivocally on the radio that people are very upset and do not want to be brought back to Libya," Sea-Eye said in a statement.
"Tripoli, however, was the destination port of the cargo ship."
Migrants in chaos-wracked Libya face trafficking, kidnap, torture and rape, according to the United Nations and aid groups.
Following Rome's increasingly tough anti-migrant stance, vessels that pick up migrants making the perilous journey across the Mediterranean increasingly return them to Libya.
Boatloads of rescued migrants have in recent months refused to disembark in Libya, prompting the authorities there to use force.
The European Union announced on Wednesday it will suspend ship patrols that have rescued tens of thousands of migrants in the Mediterranean and brought them to Italy, in the face of deep resistance from Rome's populist government.
Migrant arrivals from North Africa and the Middle East have been sharply reduced since a 2015 peak when Europe faced its worst migration crisis since World War II.