The Philippine military last week declared the end of fighting in Marawi but admitted there could be "stragglers" in the area after what authorities said was an IS bid to establish a Southeast Asian caliphate there.
Police said they arrested the 22-year-old Indonesian in Marawi after village officials found him trying to flee, adding he would face rebellion and terrorism charges.
"He is part of the siege and an initial (encounter) in Piagapo," provincial police chief Senior Superintendent John Guyguyon told reporters, referring to a military operation in April against the militants in a town 45 minutes away from Marawi.
An ensuing US-backed military campaign claimed the lives of more than 1,100 people, displaced 400,000 residents and reduced large parts of the city to rubble.
More From This Section
The Indonesian militant arrived in the Philippines last year upon the invitation of the Filipino head of IS in Southeast Asia, Isnilon Hapilon, according to Guyguyon -- citing the gunman's account given to interrogators.
Hapilon, who was on the US government's list of most wanted terrorists, was killed last month along with fellow militant leader Omarkhayam Maute.
The militants had plotted to bomb military camps in the Philippines but this did not happen because of the Marawi attack, Guyguyon said.
Authorities said they recovered a gun, a grenade and an undisclosed sum in Philippine, Indonesian and Saudi Arabian currency from the arrested militant.
There are still about twenty remaining fighters holed up in Marawi but they are surrounded by troops, Guyguyon said.
"They are not attacking (our forces) but when you enter, they retaliate.