MANILA (Reuters) - An Indonesian tugboat crewman escaped from his Islamist militant captors in the Philippines on Wednesday by swimming out to sea after the militants threatened to cut his head off, a Philippine army spokesman said.

Members of the Islamic State-linked Abu Sayyaf group captured the Indonesian, Mohammad Safyan, 28, and six other Indonesian seamen from their boat as it was passing through waters off southern Philippine islands on June 23.

Residents of Jolo island spotted Safyan floating off the shore after he escaped under cover of darkness, an army spokesman, Major Filemon Tan, told reporters.

"We were told he managed to escape by running and swimming to the sea," Tan said, adding that Safyan had said the militants were about to execute him when he escaped.

Nine hours later, soldiers, who were sent back to the area where Safyan had evaded his captors, found a second Indonesian crewman, Ismail, chief officer of the same tugboat. He was immediately brought to a clinic for a medical check-up, Tan said. No details were given on how he escaped.

Abu Sayyaf rebels operating in Muslim areas of the largely Christian Philippines have developed a reputation as ruthless kidnappers.

They have increasingly been turning their attention to vessels passing through busy shipping lanes in the Sulu Sea as security along coasts has been tightened.

The rebels, who have vowed allegiance to Islamic State, recently beheaded two Canadians they kidnapped from a beach resort after a ransom deadline passed.

Philippine President Rodrigo Duterte last week ordered the army to destroy the militants saying if not, the Philippines risked being "contaminated" by Islamic State.

Indonesian authorities have said piracy in the area, a major sea lane for the world's top thermal coal exporter, could reach levels previously seen in Somalia.

Analysts say $40 billion worth of cargo passes through the waters a year, including supertankers from the Indian Ocean that cannot use the crowded Malacca Strait.

The rise of hijackings at sea has prompted Indonesia, the Philippines and Malaysia to try to coordinate maritime patrols.

Tan said the Abu Sayyaf were holding 15 foreign hostages, including a Norwegian, a Dutch, five Malaysians and eight Indonesians. Eight Filipinos were also held in the group's jungle stronghold.

(Reporting by Manuel Mogato; Editing by Robert Birsel and Toby Chopra)