MANILA — President Rodrigo Duterte announced on Tuesday that military rule in the southern Philippines would soon end, two and a half years after he imposed it in response to a rebellion by Islamic State militants in the city of Marawi.

The Philippine military and police recommended the move last week, saying that the security situation on the southern island of Mindanao, which includes Marawi, had improved. Salvador Panelo, Mr. Duterte’s spokesman, said martial law on the island — which empowers the military to carry out warrantless arrests and set up checkpoints, among other powers — would expire on Dec. 31.

Mr. Panelo said the president was confident in “the capability of our security forces in maintaining the peace and security of Mindanao without extending martial law.” He added, “The people of Mindanao are assured that any incipient major threat in the region would be nipped in the bud.”

Hundreds of Islamist fighters from Southeast Asia and the Middle East took over Marawi in May 2017, with the goal of turning that city of 200,000 people into the center of an Islamic caliphate. The Philippines is mostly Catholic, but Mindanao has a substantial Muslim population.