The Sea-Watch 3 ship carrying dozens of rescued migrants forced its way into the Italian port of Lampedusa after a lengthy stand-off and its captain has been arrested, the charity running the boat said on Saturday.
Sea-Watch spokesman Ruben Neugebauer said Carola Rackete, 31, had been arrested after manoeuvring the ship into port without permission on Friday night.
Rackete, a hero to some but a "pain in the neck" to Italy's far-right Interior Minister Matteo Salvini, was detained for refusing to obey a military vessel, a crime punishable by between three and 10 years in jail.
Offering no resistance, she was escorted off the vessel without handcuffs and taken away in a car.
The 40 migrants still on board were eventually allowed to disembark early on Saturday and taken to the island's reception centre, some smiling, others in tears.
The Italian coastguard then took control of the boat, moved it out of the port again and anchored it just off the coast.
The ship docked despite a coastguard boat trying to prevent her from doing so by sailing back and forth between the vessel and the pier, according to the Repubblica daily.
"We put ourselves in the way to prevent (the ship) from entering the port. If we had stayed there, (the vessel) would have destroyed our speedboat," one of the police officers said in video footage posted on social media.
Residents and activists had gathered on the pier to watch the Sea-Watch 3 dock.
While a group of supporters applauded the ship and its captain, others hailed Rackete's arrest, shouting "handcuff her", "shame" and "get lost".
The dreadlocked woman has become a symbol of defiance and a left wing hero in Italy for challenging Salvini's "closed-ports" policy.
TRT World's Craig Vermay reports.
The NGO's head, Johannes Bayer, said Sea-Watch was "proud of our captain".
"She did exactly the right thing. She upheld the law of the sea and brought people to safety," he tweeted.
Salvini, who heads the far-right League party, welcomed the arrest of the captain of the Dutch-flagged vessel.
"Mission accomplished," he tweeted. "Law-breaking captain arrested. Pirate ship seized, maximum fine for foreign NGO."
Salvini has seen his popularity inch steadily upwards on his hardline anti-immigrant platform.
Italian Prime Minster Giuseppe Conte said: "I don't want to take the place of the judiciary ... But the laws exist, whether we like it or not."
Prosecutors in Sicily have launched a probe into Rackete on suspicion of aiding illegal immigration.
The captain, however, was unrepentant.
After announcing she would be investigated, "the prosecution ... notified us that they will not help to bring the rescued off the ship," Rackete had said in a video statement on Twitter.
"I have decided to enter the harbour, which is free at night, on my own," she added.
Rackete had previously warned she was worried about the psychological condition of those rescued off crisis-hit Libya.
"It has been almost 60 hours since we declared a state of emergency. No one listened. No one took responsibility. Once more, it's up to us to (bring) the 40 people to safety," the charity said on Twitter.
With Italy restricting port entry, the vessel had been stuck in the Mediterranean during a heatwave since rescuing 53 migrants drifting in an inflatable raft off the coast of Libya on June 12.
On Wednesday, as tempers on the small boat frayed, Rackete decided she had no choice but to enter Italian waters illegally to bring the remaining migrants to safety.
Migrants are continuing to arrive in Italy, even if not in the same numbers as during the period between 2014 and 2017.
Nearly 500 migrants have landed on its coast over the past 16 days, according to the interior ministry.
Meanwhile, the founder of Spanish migrant rescue charity Proactiva Open Arms said he was prepared to risk prison in order to save lives in the Mediterranean following Sea-Watch's example.
"If I have to pay the price through prison time or a fine in order to save the lives of some people, then I will do so," said the group's founder Oscar Camps.
The Open Arms ship took to the waters off the Libyan coast on Thursday, a decision that could already cost it a fine of up to 900,000 euros ($1 million) from the Spanish government, Camps said.
"At the moment, there is no organisation out there (off the Libyan coast)," Camps said.