On Monday, a court in Madrid charged the two Somalis captured by the Spanish navy with armed robbery and kidnapping.

'Difficult weeks'

Addressing journalists in Madrid, Zapatero said: "I can confirm that the Alakrana fishing trawler is sailing freely toward safer waters and that all of its crew members are safe and sound."

In depth

 Special programme: Pirates' haven
 The pirate kings of Puntland 
 Video: Lucrative raids lure Somali youth
 Video: Meet the pirates
 Q&A: Piracy in the Gulf of Aden

"They are coming home, these difficult weeks have come to an end. This is very good news for the entire country."

The Alakrana was captured last month about 740km northwest of the Seychelles island of Mahe.

The ship's crew included 16 Spaniards, eight Indonesians and others from the Ivory Coast, Ghana, Madagascar, Seychelles and Senegal.

Attacks off Seychelles have surged after pirates extended their range to evade navies patrolling off the Horn of Africa.

The multinational naval force operating in the area said on Tuesday that pirates had seized a Virgin Islands-owned chemical tanker with 28 North Korean crew members 290km northwest of Seychelles.

The naval force said the 22,294 tonnes tanker, the MV Theresa VIII, had been sailing to the Kenyan port of Mombasa but had turned round after being seized near the Indian Ocean archipelago and was now heading north.

Pirates in Haradheere said they had hijacked the ship, which operated from Singapore, on Monday.

There was a pause in hijackings during monsoon rains, but the Somali sea gangs have stepped up attacks in the past two months.