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 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, Maj. Filemon Tan, told reporters.