The two leaders were named as Isnilon Hapilon, who was declared the terror group's emir for Southeast Asia, and Omar Maute, a leader of a local militant group that had pledged allegiance to ISIS.
The pair were killed, along with seven other militants, while attempting to exit a building at street level during a four-hour firefight, Gen. Eduardo Ano of the Philippines Armed Forces said at a news conference. Maute was shot in the head by a sniper.
Their bodies were positively identified by a former hostage, Ano said. They will be buried in accordance with Islamic rites in an undisclosed location.
"It will be just a matter of days before it can finally be declared that Marawi has been liberated from the clutches of terrorists," he said.
More than 800 militants and 162 government security forces have been killed in the nearly 150 days of fighting, and about 1,700 hostages have been rescued, including 20 on Monday, said Ano.
"The political and military leadership of the ISIS movement (in the Philippines) has essentially been neutralized," Heydarian told CNN.
There are still 22 hostages and eight foreign militants remaining, according to Ano.
How the fighting started
Hapilon is thought to have issued an emergency call for reinforcements from members of the Maute group, which was headed by Omar and his brother Abdullah.
Abdullah was rumored to have been killed in early September, but the military has yet to confirm his death. Omar's death had been reported multiple times in the past, though never confirmed.
"The Maute brothers were essentially the military brain and engine of the whole ISIS-affiliated movement in the Philippines," Heydarian said.
After Hapilon called for backup, militants poured into the city by the hundreds, setting fire to buildings, taking hostages and entering into running street-battles with government forces.
Who was Hapilon?
Hapilon, a skinny, baby-faced 51-year-old with a tufty goatee beard, had been dodging Philippines authorities for over a decade, since he emerged as a ruthless and deadly commander of the Abu Sayyaf militant group in the early 2000s.
Last year, Hapilon -- who headed a major faction of Abu Sayyaf -- was designated by ISIS as the terrorist organization's emir for Southeast Asia and commander of the so-called Brigade of the Migrant based on the southern island of Mindanao and made up of fighters from Malaysia, Indonesia and the Philippines.
Despite the hefty bounty on his head -- and pursuit by US and Philippines special forces -- Hapilon managed to avoid capture for 16 years.
During that period, the tactics deployed by Abu Sayyaf grew more extreme and more deadly.
The end of fighting?
"They will not disappear. They will regroup anywhere and everywhere," Duterte said.
"Be patient. This terrorism inspired by ISIS will not go in about seven to 10 years ... terrorism is a deadly movement to confront us and our children. Your children will encounter this. It will reach your retirement age. So just be prepared for that," he said.
Heydarian, the security analyst, said the Philippines must step up its intelligence-gathering operations to stop these types of attacks in the planning phase.
ISIS will "try its best to show they're still alive and kicking. You can imagine what kind of things they'll be thinking about to send that message across," he said.