MANILA — Thirteen Philippine marines were killed and at least 40 others were wounded in a 14-hour clash with militants linked to the Islamic State in the city of Marawi, the military said on Saturday.

It was believed to be the deadliest single-day toll for military forces battling Islamist militants from the Abu Sayyaf and Maute groups that seized part of the city in May, beginning a wave of violence across Marawi and displacing tens of thousands of Filipinos.

The battle erupted at dawn on Friday after the marines targeted militants holding several civilian hostages, and the fighting stretched into dusk. The clashes were still continuing on Saturday, said Col. Edgard Arevalo, a military spokesman.

“The marines were able to inflict heavy casualties to the terrorist group,” Colonel Arevalo said.

The militants’ siege has become the greatest test of the year-old presidency of Rodrigo Duterte, who previously dismissed the Maute group as bandits who could be easily defeated. The fighting led Mr. Duterte to impose martial law over the southern Philippines in May.