Pirates have intensified attacks on shipping in recent weeks
An attempted attack by Somali pirates on a Norwegian tanker was foiled by Nato warships and helicopters after an overnight pursuit in the Gulf of Aden.
Nato said a Canadian warship caught the pirates before releasing them after the gang attacked the MV Front Ardenne.
The alliance said the pirates had been released because they could not be prosecuted under Canadian law.
On Saturday, Dutch commandos serving with the Nato anti-piracy operation freed 20 pirate captives from Yemen.
In that incident, too, the raiders were released.
American forces joined in Sunday's pursuit of pirates who used rocket-propelled grenades in an attack on the 80,000-tonne MV Front Ardenne.
Portuguese Lt Cdr Alexandre Santos Fernandes told AP news agency the raiders only stopped after repeated warning shots were fired.
He said the gang was interrogated and disarmed before being released.
A spokesman aboard the Canadian warship, the Winnipeg, Michael McWhinnie, said they had switched off all lights to hunt the fleeing pirates through the night.
"We blocked their path. We were faster and surprisingly more manoeuvrable than the pirate skiff," Mr McWhinnie told Reuters news agency.
Pirates have intensified attacks on shipping in recent weeks in one of the world's busiest sea lanes, despite patrols by the foreign navies.
In another incident on Saturday, Somali pirates seized a Belgian ship and its 10 crew, including seven Europeans.
Nato's success this weekend is the latest in a string of recent Western military operations against the pirates.
French and US troops have both taken action against pirates in recent days.
The French rescued three people from a captured yacht in an assault which saw one man killed.
Last week US troops killed three pirates and captured another as they rescued the American captain of a tanker from captivity.
US Secretary of State Hillary Clinton recently unveiled a plan to tackle piracy in the Gulf of Aden and the Indian Ocean off Somalia.