(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."