(CNN)A migrant rescue ship has docked in Malta after being stranded for days in the Mediterranean amid a diplomatic dispute over which country should accept the 141 migrants on board.
The migrants, including two pregnant women and 67 unaccompanied minors, disembarked from the Aquarius Wednesday at Senglea, a port city in Malta. They will soon be sent to locations in France, Germany, Luxembourg, Spain and Portugal, which have agreed to take them.
The mood on board was jubilant as the ship neared the port, according to video tweeted by charity Doctors without Borders (MSF). The images also showed a large sign suspended on an outside wall at the port that read, "Everyone has the right to life."
In another video, upbeat music can be heard blaring as the ship docked. Images show mothers leading their children down the gangway, and migrants hugging crew members goodbye.
The migrants were rescued last Friday off the coast of Libya by the Aquarius, which is operated by charities SOS Méditerranée and MSF. Many were from Somalia and Eritrea, with some reported to have been held in inhuman conditions in Libya, SOS Méditerranée said.
However, the migrants ran into further trouble when Malta, Italy, the UK, and Spain all denied responsibility for the migrants, leaving the ship stranded at sea.
Ship stranded as countries argue
As the countries engaged in a back-and-forth diplomatic tussle, crew on board urged immediate action to help the "weak and malnourished" migrants.
"We have medical cases, (the) conditions could deteriorate at any moment," said one staff member in a tweeted video. "The people we rescued have been through hardship in Libya."
On Tuesday several EU countries convened to discuss the issue, where they agreed to share the migrants.
"Malta will be making a concession allowing the vessel to enter its ports, despite having no legal obligation to do so," Wendy Borg, spokeswoman for the Maltese government, told CNN.
"Malta will serve as a logistical base and all of the reportedly 141 migrants on board will be distributed amongst France, Germany, Luxembourg, Portugal and Spain."
This agreement was "a concrete example of European leadership and solidarity," she added.
SOS Méditerranée also expressed relief at the decision, but was still "gravely concerned" about the ongoing migrant crisis, the charity said in a statement Wednesday.
"Long-term sustainable solutions that address the humanitarian crisis on the Central Mediterranean are still desperately needed. This is the responsibility of the EU as a whole, and we look forward to seeing more concrete examples of European leadership and solidarity on this issue in the future."
The disembarkation was overseen by the UN Refugee Agency (UNHCR), according to a statement from the Maltese government. The migrants were examined by health authorities upon arrival, with some pregnant women and infants sent to hospital for further care.
The European delegations are now coordinating the redistribution process.
The migration crisis continues
The Aquarius was also briefly stranded in June while carrying 630 migrants after Italy and Malta refused to allow it to dock. France was thrown into the mix when French President Emmanuel Macron criticized Italy's position, escalating tensions.
Spain finally agreed to accept the migrants, but the conflict revealed a fractured Europe, and the Aquarius became a symbol of the migration crisis in the Mediterranean.
In late June, weeks after the dispute, European Union leaders struck a deal on migration to more widely share refugees among member states. The EU agreed to provide more support to Mediterranean countries like Italy, but the voluntary deal lacked concrete details, and many questions remain unanswered.
As of August 8, there have been an estimated 1,524 deaths on the route this year, according to the International Organization for Migration, with the majority of the 60,309 migrants and refugees arriving through Spain and Italy.