Spokesman of the Western Mindanao Command Major Filemon Tan said that four soldiers were beheaded in the fighting against about a hundred Abu Sayyaf rebels.
Five Abu Sayyaf fighters were killed, including one Moroccan national, and 20 others were injured in a nine-hour gun battle on the island of Basilan, he said, adding that military operations were launched against the group after a series of abductions of foreigners.
Established in the 1990s, Abu Sayyaf consists of some 400 Muslim extremist rebels in the southern Philippines. They are infamous for kidnapping foreigners and demanding huge ransoms as well as carrying out beheadings.
The group was said to be responsible for the worst terrorist attacks in the Philippines, including the 2004 Manila Bay ferry bombing which left 100 dead.
It is fighting for an independent Islamic nation in the region.