Somali pirates on Thursday handed over an oil tanker and eight Sri Lankan hostages captured just days ago, the Oceans Beyond Piracy NGO told AFP, bringing to a close the first such attack since 2012.
"The Puntland maritime police force freed the ship. They made (the pirates) an offer they couldn't refuse and the pirates have left," said John Steed, a former British army officer with the NGO who has spent years negotiating the release of piracy hostages in Somalia.
Earlier on Thursday the Puntland coastguard had threatened to use force if the talks to convince the pirates to release the vessel failed.
Armed attackers seized the Aris 13 on Monday as it made its way from Djibouti to Mogadishu, the first hijacking of a large merchant vessel by Somali pirates since 2012.
Steed said the pirates had left the Aris 13 ship, which was under control of the coast guard and on its way to the port city of Bossaso in the semi-autonomous Puntland region, on the northeastern tip of Somalia.
He was not able to provide more details on the conditions for the release of the vessel.
Abdirahman Mohamud Hassan, the director general of the Puntland maritime force, said earlier that a regional governor, who was not named, had been appointed to negotiate with the pirates.
The successful release came after a fierce firefight between the coast guard and armed men aboard a boat believed to be taking food and provisions to the hijacked tanker.
"Our forces were doing a normal routine patrolling around the area when they came under gunfire from these gunmen who were onboard a small skiff and they returned fire," said Hassan.
Steed said an unknown number of people had been injured in the exchange of gunfire.
At the time the tanker was taken it was forced to change course and head toward Puntland. The Aris 13 was about 18 kilometres off the Somali coast when it was attacked, according to Steed.
He said the vessel was not following the "best practices" put in place to avoid piracy, since it was taking a cost- and time-saving route too close to Somalia's coastline, was travelling too slowly and was without an armed escort.
Village elders in Alula where the hijacked vessel first docked, said the pirates had not made clear demands, but claimed to be driven by anger over illegal fishing.
"These are fishermen who are infuriated with the illegal fishing off their coasts. They desperately need to show their grievances by seizing the boat," said Abdiwahab Ahmed, an elder in Alula.
Somali pirates began staging waves of attacks in 2005, seriously disrupting a major international shipping route and costing the global economy billions of dollars.
At the peak of the piracy crisis in January 2011, 736 hostages and 32 boats were held.
Though anti-piracy measures ended attacks on commercial vessels, fishing boats have continued to face attacks.
Steed says the international community had taken significant steps to improve security, boosting naval forces in the area and requiring ships to take protection measures.
"Hundreds of pirates were arrested, others gave up, and we hadn't had an attack of a commercial ship for five years," he said.
"But the one thing that's not really been addressed is the real root cause of this, which is poverty and the lack of jobs on the ground. There's also a drought, so there's no food, no water."
Illegal fishing has long been used by Somali pirates as an excuse for attacks and Steed has in the past warned that the presence of foreign vessels emptying Somali waters could reverse the gains against piracy.
"The question wasn't really if an attack was going to happen, the question was when," said Steed.