ROME — A rescue ship carrying 42 migrants floated in Italian waters off the Mediterranean island of Lampedusa on Thursday, further inflaming tensions between humanitarian groups and Italy’s populist government, which has adopted hard-line immigration policies.

The ship, the Sea Watch 3, is operated by Sea-Watch, a German nongovernmental organization, and flies a Dutch flag. It has been at sea for two weeks, awaiting instructions for a safe harbor at which to disembark the migrants, which it picked up in international waters off Libya. The vessel entered Italian waters Wednesday evening.

Although new Italian legislation forbids the ship from entering a port without authorization, the Sea Watch 3’s captain decided to move forward, citing an emergency situation. “We are entering Italian territorial waters out of a state of necessity,” Capt. Carola Rackete said in a radio communication with the port authorities in Lampedusa on Wednesday.

“I know what I’m risking, but the 42 survivors I have on board are exhausted. I’m taking them to safety,” Captain Rackete said on Twitter on Wednesday.