Updated

A rescue ship carrying hundreds of migrants that was stranded in the Mediterranean for five days will finally dock in Malta.

The breakthrough came after a group of five European lawmakers – three Germans, one Spaniard and one Portuguese – spent hours on board the ship Lifeline on Sunday night negotiating with Italian and Maltese authorities for permission to dock.

Michael Brandt, a German member of parliament, described the conditions as “unbearable” on board the boat.

Italian Premier Giuseppe Conte said after a phone call with his Maltese counterpart that the Lifeline would be able to dock in the Mediterranean island nation, where its legal standing would be investigated.

SPAIN RESCUES 569 MIGRANTS CROSSING THE MEDITERRANEAN FROM AFRICA

He said that Italy would host some of the migrants and called on others to follow his lead. Four countries, including Portugal and Germany, have already signaled they will take in some of the 234 migrants.

Italy and Malta also have said the ship’s captain will be investigated over allegations he ignored instructions to let the Libyan coast guard pick up the migrants.

The Lifeline has been stranded in the Mediterranean since last week, after both Italy and Malta refused to allow it to dock. Italy’s Sky TG24, which visited the boat on Monday, claims it is about four times over passenger capacity and running low on fuel.

ITALY REFUSES RESCUE SHIP CARRYING 224 MIGRANTS TO DOCK: '[THEY] WILL ONLY SEE ITALY ON A POSTCARD'

lifeline 2

The breakthrough came after a group of five European lawmakers – three Germans, one Spaniard and one Portuguese – spent hours on board the ship Lifeline on Sunday night negotiating with Italian and Maltese authorities for permission to dock (Felix Weiss)

One passenger was evacuated on Monday because of a medical emergency. Confusion over where the boat should dock was exacerbated by both sides, with Joseph Muscat, Malta’s prime minister, saying the country had “no responsibility” in the rescue, while Matteo Salvini, Italy’s hardline immigration minister, said those on board would “only see Italy on a postcard.”

In a statement on Twitter, a spokesman for the German aid ship wrote: “For days we have to read on Twitter what happens to us. Hardly any direct message.

“Now we read,that we are allowed to enter Malta. We welcome Maltese support, but we now need EU countries to welcome the people.

“That was what Malta asked for, and that is what we asked for.”

Salvini, who has likened the rescue ships to taxi services for people smugglers, wrote on Twitter: “This illegal ship will finally be seized.

“For women and children truly fleeing war, the ports are open, for all the others, no.”

The diplomatic wrangling over who is responsible for the Lifeline was similar to the impasse over the Aquarius, a French aid group-operated ship, which carried 630 migrants and was ultimately accepted by Spain after Malta and Italy refused to grant docking rights.

Europe has seen a huge influx of migrant arrivals since 2015, mostly from war-torn Syria and Iraq, which have seen a rise in anti-immigration parties across the continent.

More than 100 migrants rescued by a private Maersk cargo ship arrived in Sicily on Tuesday after waiting off the coast since Friday. On Saturday, Spain alone rescued 569 migrants crossing the Mediterranean from North Africa by boat.

The Associated Press contributed to this report.