MARAWI CITY, Philippines (Reuters) - Philippine troops were locked in an intense urban firefight on Sunday with the last remnants of a pro-Islamic state alliance, as the army sought to declare an end to the country’s biggest internal security crisis in years.

An estimated 30 people, including militants and some of their family members, were battling to hold a fortified, two-storey building next to Marawi City’s vast Lake Lanao, and appeared ready to fight to the death, according to the deputy commander of the operation.

“There’s just one building and they’re inside,” Colonel Romeo Brawner told a news conference.

“We believe these are ones who decided to fight it out, because they believe that if they die there they will go to Heaven.”

Brawner said soldiers were using loudspeakers to urge them to surrender, and anticipated the gunfight could go on until midnight. They did not know how many people in the building were alive or dead, he said.

The siege of Marawi has stunned the Philippines and stoked wider concerns that Islamic State loyalists have learned how to thrive in impoverished Muslim areas of the island of Mindanao and use its jungles and mountains as staging posts to launch attacks.

Those fears are compounded by the Marawi rebels’ ability to recruit young fighters, stockpile huge amounts of arms and endure five months of ground offensive and government air strikes that have devastated the city.

Slideshow ( 16 images )

The military made a significant gain with last week’s killing of Isnilon Hapilon, Islamic State’s “emir” in Southeast Asia and Omarkhayam Maute, a leader of the Maute militant group.

Another leader and possible bankroller of the operation, Malaysian Mahmud Ahmad, was likely killed also, the military said.

Brawner said the authorities believed foreign operatives were among those still fighting and it was clear there was now a leadership vacuum.

“At this point we don’t know who is really the leader,” he added.

“Our government forces will try to do everything to finish the firefight today.”

Troops have started a phased withdrawal and the authorities may soon allow some residents to return to homes not damaged by the fighting, which displaced at least 300,000 people.

More than 1,000 have been killed, mostly militants.

The government estimates the rebuilding of Marawi could cost at least 50 billion pesos ($971 million).