Updated

Using machetes and guns, the men fought a desperate battle to take control of two boats off the Somali coast. But this time, it wasn't pirates who launched the attack — it was Egyptian fishermen who had been held hostage for four months and who killed two brigands and took others captive as they regained control of their vessels.

On Friday, the roughly three dozen newly liberated fishermen sailed toward home. One pirate was in custody in Somalia after local fishermen found him near shore with machete wounds, police said.

Another pirate, who said he escaped during the fight on Thursday, described the struggle in a telephone interview with The Associated Press.

"They attacked us with machetes and other tools, seized some of our guns and then fought us," said the pirate who identified himself only his nom de guerre, Miraa. "I could see two dead bodies of my colleagues lying on the ship. I do not know the fate of the nine others."

The fishermen on both vessels coordinated their attack and some of the pirates even cooperated with them, making it easier for the other gunmen to be overpowered, said Mohamed Alnahdi, the executive manager of Mashrq Marine Product, which had hired the fishing boats.

"The crew on both boats started their operations at one time. They were coordinating among themselves," he told the AP in a telephone interview from Bossaso, a Somali town where he spent more than a month trying to negotiate the fishermen's' release.

Alnahdi, whose company is based in Yemen, said the ransom talks deadlocked Thursday, with him offering $200,000 but the pirates demanding $1.5 million.

The Ahmed Samara and Momtaz 1fishing boats sailed Friday for Yemen, where the crews were to hand over the captured pirates. The crew will then fly home to Egypt, said Mohammad Nasr, owner of the Ahmed Samara.

The struggle took place off the coastal town of Las Qorey along the Gulf of Aden, one of the world's busiest waterways. It is infested with Somali pirates.

Pirate attacks worldwide more than doubled in the first half of 2009 amid a surge in the Gulf of Aden and the east coast of Somalia, which together accounted for 130 of the cases, according to an international maritime watchdog. International patrols, including by U.S., European, Chinese, Russian and Indian ships, have failed to halt the pirate attacks.

The ending to the fishermen's four-month ordeal was unusual, but it wasn't the first time a crew fought back.

In April, an American crew fought off Somali pirates until the crew's captain offered himself as a hostage in a bid to save their lives. He was held hostage in a lifeboat for five days and was freed after U.S. Navy snipers killed three of his captors.

Somalia has not had an effective government since the 1991 overthrow of a dictatorship plunged the country into chaos. The power vacuum has also allowed pirates to operate freely around Somalia's 1,900-mile (3,060-kilometer) coastline.

In June, the U.S. House of Representatives passed an amendment that would require the Department of Defense to put armed teams on U.S.-flagged ships passing through high-risk waters, specifically around the Horn of Africa. The amendment now goes to the Senate.

The laws of many nations prevent vessels from carrying weapons.