Soldiers from Somalia's semi-autonomous Puntland region have stormed a Panama-flagged cargo vessel held by pirates, a Puntland minister has said.
The pirates, who refused to surrender, killed the captain of the ship, he said.
There was a brief shoot-out with the seven pirates before they were captured, he added.
The pirates seized the 15,000-tonne ship, MV QSM Dubai, in the Gulf of Aden in the early hours of Wednesday.
"Our troops stormed the Panama-flagged vessel and engaged the pirates. There was brief fighting before they defeated them," Said Mohamed Raage, Minister of Ports and Marine Transport, said.
"We arrested seven pirates after they killed the captain of the ship."
The vessel has a crew of 24 made up of Ghanaian, Egyptian, Pakistani and Bangladeshi nationals, and was taking supplies to northern Somalia.
It was sailing from Brazil in the "internationally recommended transit corridor" in the gulf when it was seized.
Puntland, which declared itself an autonomous state within Somalia in 1998, has been used by pirates as a base of operations.
On Wednesday, the crew of a Libyan-owned merchant ship seized by Somali pirates in the Gulf of Aden were reported to have recaptured their vessel.