Migrants trapped on a ship in a Sicilian port for six days have been allowed to disembark, bringing a stand-off between the Italian government and other European states to an end.
Italy had refused to allow most of the migrants off until a solution was reached regarding their relocation.
Late on Saturday, Interior Minister Matteo Salvini revealed a number of bishops had agreed to take them in.
Mr Salvini is under investigation for his role in the stand-off.
Sicilian prosecutors opened an inquiry into possible illegal confinement, illegal arrest, and abuse of power.
The fate of the 140 migrants, most of whom are Eritrean, has prompted local protests throughout the week and attracted international attention.
The Diciotti arrived in the Sicilian port of Catania last Monday, but until Saturday only small groups had been allowed into Italy, including unaccompanied children and the sick, two of whom are said to have tuberculosis.
Mr Salvini refused the vessel permission to disembark until the EU agreed to distribute the migrants among other countries, saying he did not want the migrants to be a “burden” on Italian citizens.
Under EU rules, people must seek asylum where they arrive, but Italy has increasingly barred boats from docking.
Announcing the end of the stand-off, Mr Salvini said the bishops were “opening their doors, their hearts and their wallets” to the migrants.
Ireland and Albania have also reportedly agreed to take a number of the migrants in.
The resolution comes after the UN appealed for EU members to “urgently” offer relocation places to the migrants.
UN High Commissioner for Refugees Filippo Grandi said in a statement that Europe has recognised “a fundamental and legal obligation” to help “people fleeing war, violence and persecution” throughout its history.
“The time has come to end the back-and-forth that has seen countries competing in a race to the bottom on who can take the least responsibility for people rescued at sea,” he said.
“It is dangerous and immoral to put the lives of refugees and asylum-seekers at risk while states engage in a political tug-of-war on long-term solutions.”
Sixteen people were allowed to disembark on Saturday on doctors’ orders after inspectors from the Italian Healthy Ministry and the Red Cross went on board the vessel.
Earlier this week 27 unaccompanied minors and 13 people in need of urgent medical help were also allowed to get off.
Some of those left onboard were reported to be refusing food in protest.
Since 2014, more than 640,000 migrants have landed on Italy’s shores. Although many have since left for other countries, some remain.
The UN says that more than 1,600 people have lost their lives trying to cross into Europe in 2018, despite overall numbers being down.
In July 450 migrants were allowed to disembark in Sicily once France, Germany, Malta, Portugal and Spain had each agreed to take 50 migrants each.