A security campaign against Shia Muslim fighters in eastern Saudi Arabia has reduced dozens of buildings in the town of Awamiya to ruins and forced thousands of residents to flee.

Security forces have been trying for three months to flush out fighters responsible for years of attacks on police in the small town of 30,000 that has been the centre of protests by minority Shia Muslims against the Sunni government.

Journalists on a government tour of the town on Wednesday were the first outside witnesses to the damage caused by the fighting in the otherwise tightly controlled kingdom, a key Western ally and the world's top oil exporter.

Reporters escorted by special forces in armoured vehicles saw streets in Awamiya's old quarter transformed into a war zone a world away from the sparkling cityscapes elsewhere in the energy-rich Gulf.

There was no fighting during the tour, although residents reported an explosion and gunfire shortly afterwards.

Rusted cars lay half-flattened next to wrecked homes pocked with hundreds of bullet holes.

Crudely photocopied portraits of "martyrs" - one apparently 16 years old - were tacked on to lamp posts and buildings.

"The land which is mixed with the blood of martyrs gets sufficiently watered by God's light to defeat the mighty," said graffiti along one rubble-strewn street.

Final push

Fighting picked up this month when elite forces joined an operation that began in May to tear down the old quarter, known as al-Musawara, to prevent fighters using its narrow streets to evade capture.

Casualty figures have not been published, but an interior ministry representative said eight members of a police rapid response team and four special forces troops had been killed since the latest campaign began.

Residents said nine civilians had been killed in the violence in the past week and more than 20,000 had fled or been evacuated to safer towns and villages nearby.

OPINION: On ISIL, Arab TV and post-ideological politics

Activists said five fighters and 23 civilians were killed in the fighting. Among them was a three-year-old boy, who died on Wednesday after having been shot in his family's car by an armoured vehicle in Awamiya in June.

The ministry representative said the old quarter had been empty except for "terrorists" for the past six months, but the security forces had to wait until families left adjacent areas before they could begin their final push.

The authorities say they are clearing the area to build an attractive district of shopping centres, office buildings, green spaces and fountains in place of al-Musawara.

"We informed everyone in the community there would be development stages for several areas in Qatif, starting with al-Musawara," said Esam Abdullatef Almulla, the region's acting mayor.

He dismissed concerns raised by United Nations experts in April that the demolition of the 400-year-old neighbourhood threatened Awamiya's cultural heritage, saying the majority of the community accepted the project.

"Of course, we didn't get approval from everyone, but most Qatif and Awamiya residents wanted to see their neighbourhoods developed," said Almulla.

The government compensated residents who had to leave with more than 800 million riyals ($200m) and has demolished about 80 out of 488 homes in al-Musawara, he said.

May sow discontent

Footage on social media on Wednesday showed security forces celebrating by linking arms and dancing in a circle, their automatic weapons raised in the air.

But the fighting may not yet be over, and the campaign may sow more discontent among the Shia population, which complains of discrimination. Saudi authorities deny that charge.

Posters of local Shia religious leader Nimr al-Nimr, whose execution last year set off a wave of protests and prompted a break in diplomatic relations between Saudi Arabia and Iran, still hung throughout the town.

Around 10 bulldozers worked to demolish more buildings and clear up the detritus of combat, the soldiers driving them still wearing helmets and body armour.

The bright pink walls of a child's bedroom lay exposed on the first floor of a collapsed house. A dog wandered around the town's abandoned streets, dragging an orange leash behind him.