Image caption The pirates' skiff was left burnt-out after the attack on the USS Ashland

A Somali man has admitted attacking a US warship in April after mistaking it for a merchant vessel.

Jama Idle Ibrahim and five others chased the USS Ashland and opened fire on it before being captured, court papers said.

He pleaded guilty to piracy-related charges in Norfolk, Virginia, and faces 30 years in jail. Five other Somalis also face charges over the attack.

Prosecutors said it was Norfolk's first piracy-related conviction in 150 years.

"Modern-day pirates must be held accountable," said Neil MacBride, prosecuting.

After making a deal with the authorities, Ibrahim pleaded guilty to attacking to plunder a vessel, engaging in an act of violence against people on a vessel, and using a firearm during a crime of violence.

Both Ibrahim and the authorities had agreed to a 30-year jail term, and he faces a sentencing hearing on 29 November.

Earlier this month a judge had dismissed a piracy charge - which carries a mandatory life sentence - against Ibrahim and his five alleged accomplices.

The gang had chased the USS Ashland in a skiff in the Gulf of Aden on 10 April, opening fire on it.

US Navy personnel returned fire, killing one Somali and wrecking the men's skiff, prosecutors said.

But the judge dismissed the more serious piracy charge because the group had not robbed, boarded or taken control of the US Navy ship.

Somalia has been ravaged by internal conflict for two decades, and pirates have flourished amid the lawlessness.

Foreign countries have generally been reluctant to try suspects in their own countries, so pirates are often allowed to go free after an unsuccessful attack.