Firefighters have contained a blaze high in the rugged forested mountains of western China that claimed the lives of 30 of their colleagues.

State media say open flames had been extinguished and only a few areas continued to emit smoke as of Tuesday with no further threat of the fire spreading.

The bodies of the dead firefighters were brought to the town of Xichang in Sichuan province, while three helicopters had brought in reinforcements to extinguish the blaze for good.

Changing winds Sunday apparently trapped the 27 firefighters and three helpers.

The death toll appeared to be the worst among firefighters since 2015, when an explosion at a chemical warehouse in the port of Tianjin killed 173 people, most of them firefighters and other first responders.