MOGADISHU, Somalia — Somali pirates who seized a Comoros-flagged oil tanker this week after five years without a major hijacking in the region have released the ship and its crew without conditions, officials said late Thursday.

Security official Ahmed Mohamed said the pirates disembarked the ship, which was heading to Bossaso port, the region’s commercial hub, with its eight Sri Lankan crew members aboard.

Mohamed said the release occurred after negotiations by local elders and officials with the pirates, who seized the tanker Monday.

The pirates were not arrested but instead were given passage to leave once they disembarked, he said.

Naval forces from the semiautonomous state of Puntland and the pirates had clashed earlier Thursday after the pirates opened fire. The hijacking of the tanker Aris 13 was the first such seizure of a large commercial vessel off Somalia since 2012. International anti-piracy patrols on the crucial trade route had calmed such attacks, which once numbered in the hundreds.

Abdirizak Mohamed Ahmed, the director of Puntand’s anti-piracy agency, confirmed the release of the ship Thursday night and said naval forces had boarded it to escort it to port.

The European Union anti-piracy operation in the region had said the pirates had been holding the crew captive and demanding a ransom. The ship had been anchored off Somalia’s northern coast, known to be used by weapons smugglers and the extremist group al-Shabab.

Ahmed said the Puntland naval forces had been dispatched to the area not to free the ship by force but to cut off any supplies to the pirates.

Families of the crew members had tearfully pleaded for the men to be released unharmed. Somali pirates usually hijack ships and crew for ransom.

The ship had been carrying fuel from Djibouti to Somalia’s capital, Mogadishu, on Monday when it was approached by men in two skiffs and the tanker issued a call for help.

The pirates told authorities that the only reason they seized the ship was in protest of the illegal fishing in the area that has threatened livelihoods, not for ransom, Mohamed said.