RICHMOND, Va. — A federal appeals court in Virginia has made it clear that someone doesn’t have to board a ship or rob it to commit piracy.

A three-judge panel of the 4th U.S. Circuit Court of Appeals ruled in two separate piracy cases Tuesday.

In one, it upheld the convictions and life sentences of five Somali men who attacked the USS Nicholas in waters off Africa. In the other, it vacated a pre-trial ruling in a separate attack on the USS Ashland in which piracy charges against five other Somalis were dropped.

“For decades, the international community has considered violent attacks on the high seas as an act of piracy, and today’s ruling will strengthen our ability to hold those who attack U.S. vessels by force accountable, regardless of whether they are successful or not,” said U.S. Attorney Neil MacBride, whose office handled both piracy cases.

In the Nicholas case, the five men were found guilty by a jury in Norfolk in the April 1, 2010, attack. The USS Nicholas was in the Indian Ocean north of the Seychelles Islands when it was attacked by three men in a skiff, who fired rocket-propelled grenades and raked the ship with AK-47 fire. No sailors were injured in the attack.

During arguments before the federal appeals panel, an attorney representing one of the Somalis said the government was using “amorphous” interpretations of international law to make the piracy count stick. The attorney, James R. Theuer, said the Supreme Court has been clear that the key element of piracy was “robbery at sea.”

The government argued that piracy included “violent attacks on the high seas.”

The Nicholas, which was part of an international flotilla combating piracy in the seas off Africa, was mistaken by the defendants for a merchant ship because the Navy used a lighting array to disguise the 453-foot warship and attract pirates.

In August 2010, a judge in Norfolk dismissed piracy counts against five defendants accused in an attack on the USS Ashland. The judge concluded that since the men had not taken control or robbed the ship their actions did not rise to the nearly 200-year-old U.S. Supreme Court definition of piracy.

In the attack on the Ashland, a 610-foot dock landing ship, the ship’s 25mm cannons destroyed a skiff, killing one Somali man and injuring several others.