It was "shameful" that the migrants were stranded for days, a U.N. official said.