Two cruise ships that had carried passengers that were killed or injured in the terrorist attack in Tunisia have arrived in Spanish ports.

The Costa Fascinosa docked at the port in Palma on the Mediterranean island of Mallorca around 5 a.m. (0400 GMT) Friday while the MSC Splendida arrived at Barcelona's port in northeastern Spain three hours later.

Seventeen of the 20 foreigners killed in Wednesday's attack at Tunis' National Bardo Museum had been passengers on the ships. The dead included Japanese, French, Italian, British, Polish, Spanish, Australian, Polish and Belgian citizens.

A total of 23 people died in the shootings, including one police officer and the two gunmen.

The bodies of two Spaniards killed were expected to be flown to Spain from Tunisia later Friday.