South Korean commandos operating thousands of kilometres from home have carried out a daring raid, rescuing the crew of a freighter hijacked by heavily-armed Somali pirates in the Indian Ocean.

After a cabin-to-cabin gun battle the special forces team killed eight of the pirates and captured five of them.

South Korea's president has praised his commandos, saying it is a sign that his country will not tolerate anything that threatens the lives of its people - a warning intended to be heard all the way to Pyongyang.

They struck before the first light of dawn, with a team of navy commandos scaling the sides of the chemical freighter covered from the air by sharp shooters in a helicopter.

They had warned the Somalis to surrender but the pirates, armed with AK-47 assault rifles, heavy machine guns and rocket-propelled grenades had refused.

South Korean Lieutenant General Lee Seong-ho says fighting from cabin-to-cabin, the South Korean special forces overwhelmed the pirates in minutes.

"We have captured five pirates alive and killed eight. Unfortunately one of our commandos was injured, but not critically," he said.

"We have rescued all 21 crew members of the freighter. It was a perfect military operation."

The South Korean freighter had been hijacked a week ago after the leaving Sri Lanka for the United Arab Emirates.

The pirates had ordered the captain to make for the Somali coast, but skipper Suk Hae-kyun had stalled for time manoeuvring his ship, in what is being described as a serpentine manner.

The South Korean navy decided it was time to strike when they got word that the pirates' mothership was leaving a Somali port to rendezvous with the freighter.

The only casualty among the crew was Suk Hae-kyun, the skipper, who was shot in the stomach by the pirates during the raid.

But his condition is said not to be life threatening.

With morale in his military in the doldrums after a North Korean torpedo attack last year saw one of his warships to the bottom, South Korean president Lee Myung-bak finally had something to smile about.

"I ordered this hostage rescue yesterday," he said.

"The most important things for us are the lives and safety of our people. I will never tolerate any action which threatens that."

And that can be read not only as a warning to Somali pirates, but also to the regime over the border in North Korea.

The South Korean commandos carried out a clinical rescue mission in a lawless expanse of ocean where pirates still hold 29 ships and about 700 hostages and you can now add two more vessels captured just hours after this raid.

The five captured pirates could now be on their way to South Korea for trial, but they are luckier than some.

In another rescue operation, Russian marines freed 23 crew onboard a tanker. The pirates were later found dead adrift in a small boat on the Indian Ocean.