JAKARTA, Indonesia (AP) — Indonesian authorities said Saturday that two oil tankers — the Iranian-flagged MT Horse and Panamanian-flagged MT Freya — were released after a four-month detention for illegally transferring oil in Indonesian waters.

The two ships were freed on Friday, and their captains were allowed to leave despite being sentenced Tuesday to a year in prison for not complying with shipping channel regulations, said Wisnu Pramandita, a spokesman for Indonesia’s Maritime Security Agency.

“They have been released conditionally. They do not need to be physically imprisoned, but they cannot commit the same violation in the next two years,” he said.

Iranian state television and the Petroleum Ministry’s SHANA news agency reported the MT Horse had resumed its mission and would return home after finishing it.

The MT Freya was also fined 2 billion rupiah (nearly $140,000) for spilling oil into the sea, in a verdict from a court on Batam Island in the Riau Islands south of Singapore, Pramandita said.

Iran has sold oil on the black market since then-President Donald Trump imposed sanctions in 2018 and threatened to penalize countries that bought Iranian crude. Iranian oil tankers turn off tracking equipment to conceal their destinations.

The MT Horse and MT Freya were detained in late January along with 36 Iranian and 25 Chinese crewmembers. Days later, China’s government called on Indonesia to treat the Chinese sailors fairly, but gave no indication what their oil tanker was doing when it was found at sea transferring fuel from the Iranian ship.

___

Associated Press writer Nasser Karimi in Tehran, Iran, contributed to this report.