MARAWI, Philippines—After pulling out of the battle zone, the convoy of armored vehicles lumbered past smashed-up shop fronts and shot-up facades on its way through town.

While the powerful engines roared, the soldiers inside the sturdy machines sat silently, their faces sullen. Wooden planks had been attached to the flanks of the vehicles to add protection against high-caliber rounds, and bullets had cracked the windows of the driver’s compartments, a testament to the tooth-and-nail combat they had left behind.

Granted a rest from the fighting, the soldiers in the convoy had left the center of Marawi, a city on the island of Mindanao in the southern Philippines, where the front line is a tightening noose around a dwindling number of jihadist insurgents. But the Maute Group, named after the brothers Abdullah and Omar Maute who lead the militants, have proven difficult to dislodge.

The Mautes have pledged allegiance to the so-called Islamic State, and use many of the tactics that the terror group honed in years of conflict in Iraq and Syria.

Despite vehement antagonism toward the U.S. and its military expressed by Philippine President Rodrigo Duterte back in December, after the Mautes moved on Marawi in May, The New York Times reported U.S. Special Operations Forces were here as advisers supporting Philippine operations in June. If so, the Americans have gone or slipped out of sight. We saw no sign of them.

The Philippine military, fighting its way through a warren of heavily fortified positions, sniper nests, and explosive booby traps, has succeeded in retaking most of the city, constricting the insurgents in a shrinking pocket of resistance in the city center. Buy progress has been costly.

The army, marines, militarized police and special forces deployed in Marawi have lost around 150 men while the soldiers adapted to the urban conflict.

Over the years, the Philippine military has proved effective in fighting Islamist insurgencies that flared up in rural Mindanao and the island groups that dot the southern Philippine seas. But searching out and destroying rebel bases in the woody hillsides is a not the same as flushing out a well-prepared enemy in deadly house-to-house fighting.

“It’s difficult to enter these buildings, it’s not like fighting in the mountains,” says Sgt. Mitchell Bonilla, a veteran who has spent 16 years with the marines.

Resting in a building in the rear, a private with the elite Marine Corps Special Operations Command, known as MARSOC, contrasts the fighting in Marawi to the lightning raids on insurgent strongholds on the Sulu archipelago, where his unit was stationed before it was deployed to the city two months ago.

“Here, the enemy knows we are coming. In Sulu, they wake up and they are in hell,” he told The Daily Beast.

The MARSOC have restricted their operations to nighttime, when the special forces can rely on their superior night vision equipment to give them an edge over the Maute fighters.

The conventional army and marine units do not have the luxury of specialist training and equipment. They fight the hard way, breaking into fortified houses by blowing holes through walls and clearing rooms with grenades.

The jihadists have punched through the walls of terraced houses, as well, allowing them to move swiftly and undetected.

Sappers have defused well over a thousand improvised explosive devices that the insurgents have planted in the city.

The advance is slow. By their own admission the troops take maybe a dozen buildings a day, and it can take weeks to break through one of the defensive lines the Mautes have strung in concentric circles around the city center.

The fighting is further complicated by the hostages the Maute Group seized when it took control of the city in May. These are forced to prepare defenses and act as human shields on the front lines. Some may have been forced to take up arms against the very soldiers trying to rescue them.

According to Philippine Army Col. Romeo Brawner, captured civilians have been press-ganged into the ranks of the insurgents as the Mautes try to stave off defeat.

To limit losses as much as possible, the air force has been pounding Marawi relentlessly. Every advance on the ground is preceded by air strikes to soften up enemy defenses. South Korean-made FA-50 fighter jets fly low over the city, the roar of their engines ripping through the sky and the blast of their bombs shaking the ground. Bronco OV-10 ground attack aircraft dive from high to deliver their deadly load with pinpoint accuracy.

After four months of air and ground assault, much of Marawi has been reduced to rubble. The population of 200,000 fled the city as soon as the Maute Group took control, and most remain displaced.

Families live in tent clusters scattered along the roads that cut toward the city through the lush tropical foliage and palms in the countryside. Others have found refuge in school buildings in nearby towns. Food and other supplies are in short supply, according to local aid workers.

Marawi sits in the middle of an autonomous zone created for the Philippines’ Muslim minority, which is concentrated on Mindanao. It is officially known as the “Islamic City of Marawi,” as it is the only city in the largely Catholic country that has a majority Muslim population.

The displaced say the hardships they have faced over the past months are not due to the Mautes alone. Many also accuse the government of a lackluster response to the humanitarian crisis, and feel they are discriminated against on the basis of their faith.

“If the Christian community suffers, they always get help. Here it’s not really the same. I would say that is a form of discrimination,” says Aslami Montila, a Marawi local working with a nongovernmental relief organization.

The government only distributes 50,000 food parcels to the displaced, far short of the 220,000 that are needed, says Montila.

He shows The Daily Beast a barren concrete building on the edge of the city of Iligan, an hour’s drive from Marawi, where about 200 families have found shelter. The large, multi-story building has in the past been used as a religious seminary, but today it has no electric light, furniture, or even glass in its windows. Several families are crammed into little allotments created by dividing the open space with cloth. A third of the 160 children at the site cannot afford to go to school since they have been forced from their homes, says Montila.

The displaced also resent the destruction of their homes. While they acknowledge that the Mautes kicked off the conflict, their city is being destroyed, to paraphrase a famous line from the Vietnam War, in order to save it.

“The people are angry with the Maute, but now they are angry with the government, too,” says Agakhan Sharief, a local religious leader who runs several Islamic schools.

The locals are also eyeing government plans for the reconstruction of the city with mistrust. No plans have yet been made public, and according to Col. Brawner, who is in charge of the military’s contribution to the reconstruction, they are still being worked out.

It is likely that parts of the city will be redeveloped for tourism. Marawi sits next to the scenic Lake Lanao, one of the biggest lakes in the Philippines, and it benefits from a gentler climate than the humid coastal lowlands.

“The city has big potential for tourism. What guarantee is there that the investment will benefit the people?” asks Abdul Atar, who holds the largely ceremonial title Sultan of Marawi.

There are fears among the Maranaos, as the inhabitants of Marawi and the surrounding countryside are known, that many residents will be kicked out of their homes to accommodate these plans.

Rumors have it that the military will seize a part of the land in the city perimeter to profit from the redevelopment of Marawi. The military denies it has any such intentions. But if the locals feel cheated out of their city, the next armed uprising is guaranteed, says Atar. “A thousand young Maranaos are ready to fight if these plans go through.”