Image caption The men said they had been promised thousands of dollars for the hijack

Five Somali men convicted of attacking a US Navy ship they mistook for a merchant vessel have been sentenced to life in prison.

The men were found guilty in November of trying to hijack the USS Nicholas, a vessel on an anti-piracy mission.

Defence lawyers claimed the men had been abducted by pirates and forced to fire their weapons in the April attack.

The men were the first convicted of piracy by a US jury since 1820, prosecutors said.

'Clear message'

The piracy conviction carried a mandatory life sentence; the men were sentenced to an additional 80 years for firearms charges in connection with the hijack attempt.

The men said they would appeal against the conviction and the sentence.

"Today's sentences should send a clear message to those who attempt to engage in piracy: Armed attacks on US-flagged vessels carry severe consequences in US courts," said US Attorney Neil MacBride.

He told reporters the sentence handed down by Judge Mark Davis was the longest ever in a piracy conviction, because the pirate convicted in 1820 was hanged.

The trial took place in Norfolk in the US state of Virginia, one of the largest naval bases in the world and home port to the USS Nicholas.

The crew of five young defendants, mostly fishermen in their mid-20s, had set sail from Somalia in March in search of a merchant vessel to plunder, according to documents filed in the federal court.

The men said they were promised thousands of dollars for the hijack.

About eight days later some the men set out to attack the USS Nicholas, which had been deployed to the east coast of Africa on an anti-piracy mission.

The Nicholas returned fire and gave chase, capturing the defendants and taking them aboard the ship and destroying their skiff.