Six Somali men went on trial Monday in Madrid accused of trying to attack a Spanish warship in 2012 during an anti-piracy operation in the Indian Ocean.
The men all denied the accusations, claiming they were "fishermen who had been fishing" at the moment they were seized by the Spanish navy, a court spokesman said.
Several Spanish seamen appeared in court as witnesses, the spokesman also said, adding that the prosecutor had asked for 23-year jail sentences for each defendant.
The case goes back to January 12 last year when the Spanish warship Patino was taking part in the European Union's Atalante operation against piracy in the seas off largely lawless Somalia.
The six suspects were seized after having attempted an attack "by boarding the ship as pirates," according to Spain's interior ministry.
The group shot at the Spanish sailors, triggering retaliatory fire, and then took off, the ministry said.
A helicopter followed the suspects and the six men finally surrendered and were taken to Spain to stand trial.
Their trial is due to run through to Wednesday with a verdict expected in the next few weeks.
In 2011, two Somalis were sentenced in Spain to long prison terms for seizing a Spanish tuna-fishing boat.
Maritime piracy by Somalians in the Horn of Africa hit its peak in 2011, but has since waned significantly in the face of stepped-up international naval patrols.