Five people were killed and about 562 people were rescued after a migrant ship capsized in the Mediterranean Sea.