Heavy rain helped firefighters who made substantial gains against a week-old wildfire that burned across 42 square miles, as thousands of people were allowed to return to their homes in Southern California mountain communities near Palm Springs.

With the arrival of an inch and a half of rain on Sunday, firefighters began to beat back the flames and had the blaze 68% contained. Rain continued to fall off and on throughout much of the day. Winds were only 5mph to 10mph and humidity was 95%.

"With diminished fire activity, firefighters made great progress with line construction, particularly along the east side toward Palm Springs," said a US Forest Service spokesman, John Miller.

The fire was still far from extinguished, however. The thunderstorm helping douse the flames also brought erratic winds and the threat of flooding, all hazardous conditions for fire crews.

Six-thousand people fled the idyllic little towns that dot the San Jacinto Mountains between Palm Springs and Hemet after the fire broke out Monday and raged across the heavily wooded area. Twenty-three structures, including seven homes, were destroyed. There were no reports of injuries. The Riverside County sheriff's department lifted evacuation orders for the communities of Idyllwild, Fern Valley and Pine Cove, from which thousands had fled the advancing flames five days before. Evacuation orders for several smaller nearby communities had been lifted earlier in the day.

The fire was less than two miles from Idyllwild on its western flank. It was a similar distance from Palm Springs below on the desert floor, where an enormous plume of smoke could be seen. The Palm Springs Aerial Tramway, which carries people nearly 6,000ft up a rugged canyon to a mountain peak overlooking the tourist resort, was closed Sunday because of unhealthy air quality. Crews were also building fire breaks in the area.

Authorities have said the fire was human-caused, but wouldn't say whether it was accidental or intentional. More than 1,800 firefighters battled the blaze on Sunday, using bulldozers, helicopters and other equipment.