BAGHDAD (Reuters) - Iraqi forces are digging a trench on the northern outskirts of Falluja a month after taking it back from Islamic State, security officials said on Saturday, raising concerns about repopulating the deserted city.

Displaced residents are waiting for Falluja's streets and buildings to be cleared of IS explosives before returning, while the troops that retook the city are gradually being replaced by local police and tribal fighters.

Even as attention has shifted north recently to an expected offensive on Mosul, Iraqi forces have continued to pursue IS fighters, estimated in the several hundreds, in western Anbar province, where Falluja is located.

The ultra-hardline militants regularly launch suicide bomb attacks against security forces near Falluja as well as near Ramadi and Hit further to the west from the open desert or farmland areas to the north.

The trench north of Falluja extends about 5 km (3 miles) east from the Euphrates river towards the main highway from Baghdad, an hour's drive away, said Major General Saad Harbiya, an army commander. It is about one meter deep and 1.5 meters wide, he said by phone.

Harbiya said the barrier was meant to keep forces posted outside Falluja from entering the city proper following allegations that homes and public buildings had been looted and burned after the IS defeat.

Keen to avoid a repeat of systematic looting after the recovery of cities like Tikrit and Baiji last year, government forces say they have managed to limit abuses to a few isolated cases in Falluja, long a bastion of Sunni Muslim insurgency and seen as a launchpad for bomb attacks in Baghdad.

Berms made of rubble and burnt-out cars went up on many roads inside the city after IS was routed in late June in order to confine an array of Iraqi forces to their separate areas of operation.

Mayor Issa al-Issawi, who fled following the IS seizure of the city in January 2014, said the trench was built for security reasons but would hinder efforts to restore life to the city, which once had a population of around 300,000.

"Falluja is now divided and we cannot work comfortably. This is not how things should be done," he said.

(Reporting by Saif Hameed and Stephen Kalin; Editing by Tom Heneghan)