Image copyright Reuters Image caption Philippine Marines are among troops battling the Islamist militants in Marawi

The Philippine military says it has made gains retaking Marawi city from Islamist militants amid clashes that have left about 100 people dead.

According to the military, militants now control only small pockets within the southern Philippine city.

But there are still reports of fighting on the ground and thousands of civilians trapped.

Nineteen civilians are known to have died. Some were found dead in a ravine with gunshot wounds to their heads.

Militants allied to the so-called Islamic State came out onto the streets of Marawi last week after the army attempted to capture a top militant leader.

Many residents fled the city as clashes erupted, but a local official said about 2,000 people were unable to leave areas held by the militants.

Spokesman for the Philippines' Armed Forces Brig Gen Restituto Padilla said troops were in "complete control of the city except for certain areas" held by militants from the Maute group, the local militants who have declared allegiance to IS.

He said that "around 40 to 50 armed elements" were still present in the city, but this may increase given the militants' activities on the ground including the freeing of more than 100 prisoners from a local jail.

He added that 18 military and police personnel had been killed and more than 61 Maute fighters.

Reports say the remaining fighters are still believed to be holding several hostages, including a priest and a number of Christians.

Image copyright Reuters Image caption Militants from the Maute group have planted black IS-style flags in parts of the city

The violence began when the army failed in its attempt to capture Isnilon Hapilon, believed to be the main IS leader in the Philippines and linked to the Maute.

In response the Maute swarmed the city, taking over a hospital and burning down buildings.

President Rodrigo Duterte then declared martial law on the southern island of Mindanao, where Marawi is located.

The Philippines, which is majority Catholic, has faced Muslim separatist movements for decades in Mindanao with its significant Muslim population.

Marawi is known as "Islamic City" in the Philippines for its Muslim-majority population.