Repeated warning shots from NATO helicopters and warships ended a dramatic pursuit of seven Somali pirates who attacked a Norwegian tanker in the Gulf of Aden, NATO says.

In the end, the pirates surrendered and were released under a technicality, and that prompted one analyst to warn that such treatment could only encourage them and other bandits to strike again off Somalia.

On Sunday, the Somali government called for the death penalty for pirates.

"Becoming a pirate is a crime, and Islam says if you become a pirate you should definitely be killed because you are killing the people," said Somalia's deputy prime minister, Abdurrahman Haji Adam. "We will announce it immediately."

But the announcement, which was linked to Saturday's vote to adopt Sharia law, is unlikely to have much effect. The government barely controls a few pockets of territory in Mogadishu, the capital, and is battling an Islamist insurgency. It has made no efforts so far to curb the heavily armed pirate gangs who openly flaunt their wealth in the coastal cities.

Islamic fighters also have threatened pirates before but have not attacked pirate bases. Instead, they allegedly have established a quid pro quo relationship with the pirates, trading protection for a cut of the ransom money.

Pirate attacks have increased in recent weeks, with gunmen from Somalia searching for targets further out to sea as ships try to avoid the anarchic nation.

Pirates have attacked more than 80 boats this year alone, nearly four times the number assaulted in 2003, according to the Kuala Lumpur-based International Maritime Bureau. They now hold at least 18 ships and over 310 crew hostage, according to an Associated Press count.

On Saturday night, American and Canadian warships and helicopters chased the pirates' skiff for seven hours after their attack on the Norwegian-flagged MV Front Ardenne, said Cmdr. Chris Davies, from NATO's maritime headquarters in England. When the pirates finally surrendered, the NATO forces disarmed and interrogated the bandits, then freed them, citing legal issues over arresting them.

The consistent failure to punish or at least detain pirates could help convince them that they have little to lose from attempting fresh attacks, an analyst said.

"It's quite encouraging for them," said Peter Lehr, the author of "Violence at Aea: Piracy in the Age of Global of Terrorism" and a lecturer in terrorism studies at Scotland's University of St. Andrews. "The threat to your life is quite low and the chance you get arrested and sent to a not so nice Kenyan prison is quite low as well," he said in an interview.

Dozens of suspected pirates are in a crowded prison in the Kenyan port of Mombasa after the United States and the European Union agreed to bring suspects there. But many more have been released amid fears of further clogging up Kenya's judicial system and conflicts with the national law of some of the countries on anti-piracy patrols.

In this case, the pirates were released because Canadian law did not allow their prosecution if they committed no crimes against Canadians or on Canadian soil.

"When a ship is part of NATO, the detention of person is a matter for the national authorities," Portuguese Lt. Cmdr. Alexandre Santos Fernandes said from a warship in the Gulf of Aden. "It stops being a NATO issue and starts being a national issue."

Canadian Prime Minister Stephen Harper, speaking at a news conference in Trinidad at the Summit of the Americas, said: "We did briefly detain pirates and disarm them, and I think those were the appropriate measures under the circumstances."

The seven had attacked the tanker late Saturday but fled after the crew took evasive maneuvers and alerted warships in the area, said Cmdr. Davies.

Fernandes said no shots were fired at the tanker.

Davies said the pirates sailed into the path of the Canadian warship Winnipeg, which was escorting a World Food Program delivery ship through the Gulf of Aden. The American ship USS Halyburton also was in the area and joined the chase.

"The skiff abandoned the scene and tried to escape to Somali territory," Fernandes said. "Warning shots have been made after several attempts to stop the vessel."

The pirates hurled weapons into the dark seas as the Canadian and U.S. warships closed in, shouting warnings through loudspeakers.