Italy has agreed to allow rescue ship Ocean Viking to disembark 82 migrants on Lampedusa after six days at sea following a European deal to distribute them.

"The Ocean Viking just received instructions from the Maritime Rescue Coordination Centre of Rome to proceed to Lampedusa," SOS Mediterranee tweeted.

"An ad hoc European agreement between Italy, France, Germany, Portugal and Luxembourg has been reached to allow the landing," said French Interior Minister Christophe Castaner, referring to the division of the migrants between the five countries.

"We now need to agree on a genuine temporary European mechanism," he added.

The offering of a safe port to the Ocean Viking is a reversal of the hardline stance taken by the country's ex-interior minister Matteo Salvini last year.

Under the far-right leader, charity vessels with rescued migrants on board faced fines of up to €1 million as well as the arrest of the captain and impounding of the boat.

Read More:

Ireland among six countries to take in migrants stranded on rescue ship
Spanish migrant ship docks after Italy row
Richard Gere, Italy's Salvini clash over migrant ship 

"Here we go, ports open without limits," Mr Salvini tweeted after the safe port announcement.

"The new government is reopening the ports, Italy returns to being the refugee camp of Europe. Abusive ministers who hate Italians," wrote Mr Salvini, who pulled the plug on the previous government in August in the hope of snap elections.

His move backfired and the League leader is now in opposition after previous ally the Five Star Movement and the centre-left Democratic Party agreed a coalition.

While Mr Salvini spent much of his time as minister launching diatribes against migrants and rescue charities, his replacement is a civil servant and immigration expert, Luciana Lamorgese.

Italian foreign minister and M5S leader Luigi Di Maio, Salvini's former ally, told Italian television that "the safe port was assigned because the European Union agreed to our request to take most of the migrants."

Medecins Sans Frontieres (Doctors Without Borders), which runs the ship jointly with SOS Mediterranee, said the group comprised 58 men, six women and 18 minors.

"They tell our medics their skin was burned with melted plastic and they were beaten with wooden or metal sticks," MSF said of the migrants who departed from chaos-wracked Libya.

"Many carry psychological wounds or trauma," MSF tweeted.

Italy is trying to set up an automatic system for distributing migrants rescued in the Mediterranean between European countries, diplomatic sources said recently.

Such a deal would put an end to the case-by-case negotiations over who will take in those saved during the perilous crossing from North Africa, which has seen vulnerable asylum seekers trapped in limbo at sea for lengthy periods.

France and Germany have reportedly given their green light to the new system, which could also involve Luxembourg, Malta, Portugal, Romania and Spain.

German Interior Minister Horst Seehofer said that under the possible future agreement, Germany would take 25% of rescued migrants landing in Italy.

He said it was time to end the "painful process" of haggling over each boatload of rescued migrants.

Italian Prime Minister Giuseppe Conte is expected to discuss the plan with France's President Emmanuel Macron when the latter visits Rome on Wednesday.

It will then be studied in more detail at a meeting of interior ministers on 23 September in Malta, ahead of a European summit in October in Luxembourg.

Mr Conte has suggested EU countries that decline to take part could suffer financial penalties.

The Czech Republic, Hungary, Poland and Slovakia have refused in the past to take in anyone rescued at sea.

The automatic distribution system would be a temporary solution ahead of a revision of the so-called "Dublin regulation", which assigns responsibility for migrants to the nation of first entry.

The number of migrants landing on Italian shores between August 2018 and July 2019 was down 80% on the previous 12 months, the interior ministry said in a report published last month.