Thirty-seven African asylum seekers stranded offshore on a German aid ship were finally allowed to disembark in a Sicilian port late Monday. But Italy's Justice Minister said the decision to allow the ship carrying the refugees to dock sets a dangerous precedent.

Italian authorities finally granted the German aid ship Cap Anamur permission to dock after a standoff that lasted nearly three weeks. Italy had at first told the refugee ship that it was not to enter the port.

The crisis came to an end Monday when Italy's Interior Minister gave the ship permission to dock at the southern Sicilian port of Porto Empedocle. The ship was allowed in on humanitarian grounds after the captain said he could no longer control the situation on board.

The German aid ship had rescued the 37 Africans from a rubber dinghy in the Mediterranean in June. The ship, claiming it had Sudanese immigrants on board, had first requested entry into a port on Malta, but was turned away.

The immigrants also asked Germany for political asylum but that request was also denied.

The vessel was finally allowed into the Sicilian port to the joy of the people on board. The Africans were taken to a holding center on the island for the hundreds of illegal immigrants who land on Sicily's shores.

The United Nations refugee agency, UNHCR, expressed satisfaction at the development. Its spokesman in Italy, Laura Boldrini, explained what the Africans can expect now.

Ms. Boldrini said the asylum seekers will be identified and their place of origin established, and then Italian law on asylum will be applied.

Meanwhile, the Italian authorities arrested the ship's captain and first officer on charges of aiding illegal immigration. They said initial checks indicated the asylum-seekers were not mainly Sudanese, as had been claimed, but probably from Ghana and Nigeria.

Italian Justice Minister Roberto Castelli said the affair created a precedent that could be devastating for Italy. The minister, a prominent member of the Northern League party, which takes a tough line on immigration, said Italy showed itself to be the soft belly of Europe.

Members of the center-left opposition said Italy had a moral duty to grant the Africans asylum, and chastised the government for waiting 12 days before allowing them to land.