(CNN) -- A U.S.-flagged ship that played a central role in a bloody hijacking drama last spring was attacked again Wednesday, a busy day for piracy in the dangerous waters off the east coast of Africa.
It was the first time a security team aboard a major merchant ship repelled a pirate attack, a top U.S. Navy officer said.
But a defensive weapon that emits a loud noise did not work, Vice Adm. Bill Gortney said in a briefing.
"They tried to employ [a long-range acoustical device] and it did not have the effect," said Gortney, the commander of U.S. Naval Forces Central Command, which is responsible for the area favored by pirates. He said he did not know why the device did not work.
The Maersk Alabama came under automatic weapons fire from pirates about 350 nautical miles east of the Somali coast, the European Union's anti-piracy force said, but fought the attackers off.
The failed attack came on a day of dramatic piracy events: The captain of a ship hijacked Monday was confirmed to have died, even as his ship was used to attack another, and a Spanish prosecutor demanded an investigation into reports that a ransom had been paid for a ship released Tuesday.
The failed attack Wednesday targeted the same ship that was hijacked in the Indian Ocean in April.
Its captain, Richard Phillips, was held hostage on a lifeboat for five days before U.S. Navy snipers shot three pirates dead. A fourth pirate was arrested, and Phillips was rescued.
This time, private security guards on the Danish-owned ship fended off the pirates, EU and U.S. naval sources said. Security had been beefed up on the vessel since the attack in April, Maersk spokesman Kevin Speers told CNN.
The ship's owners did not immediately respond to a CNN question about whether Phillips is still captain of the ship.
Somali pirates vowed revenge for the killing of their compatriots by the U.S. Navy in April, but it was not immediately clear if the Maersk Alabama was targeted intentionally or if the latest attack was a coincidence.
No casualties were reported on the ship, but pirates on land in Somalia feared the pirates who attacked the Maersk Alabama may have been killed or wounded, or may have drowned, they told a local journalist.
There has been no contact with them since they attacked the Maersk Alabama, a pirate in the central Somali town of Harardhere said. Their last communication came while they were battling the security guards on the cargo ship, the pirate said.
Pirates on land also exchanged gunfire -- with one another.
They fought among themselves Wednesday over a multimillion-dollar ransom they received for releasing a Spanish fishing boat, said a local journalist in contact with the pirates.
"There was a heavy exchange of gunfire between some of our friends" one pirate told the journalist, speaking of the other pirates. "They fought over the 3 million euro ($4.5 million) received as a ransom from the Spanish boat."
At least two pirates were wounded in the gunfight in Harardhere, a pirate stronghold in central Somalia, the local journalist told CNN. Those two pirates are in critical condition and have been transferred to the town of Galka'yo.
The Alakrana, the Spanish fishing vessel, was freed Tuesday along with its 36 crew members, Spanish Prime Minister Jose Luis Rodriguez Zapatero said. It had been held for 47 days.
Zapatero did not say how the ship was freed. Spanish media -- including CNN sister station CNN+, which cited a source it said was close to the negotiations -- reported that a ransom had been paid.
A top prosecutor in Madrid on Wednesday called for an investigation into the reported ransom.
National Court prosecutor Jesus Alonso sent a written request for the ransom investigation to Judge Santiago Pedraz, asking that the financial web involved in the alleged payment be untangled, including commissions paid to intermediaries in the negotiations, CNN+ reported from the courthouse.
The prosecutor also called on the judge to take testimony from all the ship's 36 crew members.
Various government ministers have sidestepped questions about whether a ransom was paid, but Spanish media reported the payment to the pirates totaled $3.5 million to $4 million.
A leading Spanish fishing industry executive, Juan Manuel Vieites, told CNN on Wednesday that he was certain a ransom was paid for the release of the Spanish tuna trawler.
But Vieites, who heads Euroatun -- a pan-European tuna fishing industry group -- and a Spanish tuna canning association, said he wasn't sure about the amount of the ransom. He declined to provide details.
A day after the hijacking, Spanish military monitoring the situation captured two pirate suspects as they left the fishing boat and later brought them to Madrid. The two were indicted Monday on 36 counts of kidnapping and armed robbery.
They could face sentences of more than 200 years in prison each because of the multiple kidnapping counts.
Separately, the captain of a chemical tanker seized earlier this week died of a wound inflicted during the hijacking, a pirate said.
The ship, the MV Theresa VIII, was used to attack another ship off the Somali coast, the pirate said, but did not provide any other details.
The Virgin Islands-flagged vessel, with a crew of 28 North Koreans and operated from Singapore, was seized in the Indian Ocean on Monday, according to the EU naval force.
It was heading for Mombasa, Kenya, but was hijacked in the south Somali Basin, about 180 miles northwest of the Seychelles, the EU statement said.
Pirates have captured more than 50 ships this year off Somalia.
Mohamed Amiin Adow and CNN Madrid Bureau Chief Al Goodman in Spain contributed to this report.