ROME — A rescue ship carrying more than 200 African migrants docked in Malta on Wednesday after eight European countries agreed to take them in, ending an impasse that had left the ship stranded in the Mediterranean for a week.

The solution, coming one day before a European Union summit meeting in Brussels that will cover migration, highlighted the enormous obstacles that the bloc faces in finding common ground on the issue.

Countries that border the Mediterranean and have borne the brunt of arrivals from North Africa, are increasingly insisting that other nations share the responsibility for taking them in.

But Prime Minister Joseph Muscat of Malta said that the arrangement made over the migrants onboard the ship, the MV Lifeline, was an ad hoc agreement and “not a pattern” or “a blueprint.”