Firefighters waged an aggressive ground and air assault Sunday against a wind-fanned wildfire that erupted in the San Gabriel Mountains and threatened a popular resort community.

Crews spent the day cutting fire lines while battling erratic winds. Helicopters and air tankers, which were briefly grounded due to the gusty weather, dropped water and retardant on the blaze, which grew to 7,500 acres.

Flames, chewing through chaparral and timber, advanced within a quarter-mile of the mountain resort community of Wrightwood, which was under mandatory evacuation. By Sunday afternoon, firefighters were cautiously optimistic about keeping the fire at bay, aided somewhat by cooling temperatures and higher humidity.

"Firefighters have been able to beat the flames back," said John Miller, a spokesman for the U.S. Forest Service.

CLick for more from MyFOXLA.com

Officials stressed the fight was far from over. Firefighters had to contend with shifting winds, which gusted up to 50 mph and occasionally dropped to zero.

"It's hard to get a handle on it," Forest Service spokeswoman Barbara Duruisseau said. "The wind could be blowing one way one minute and another way the next."

The so-called Sheep fire destroyed three homes in remote canyons and was 20 percent surrounded. More than 700 personnel were fighting the fire.

Between 4,000 to 6,000 residents were ordered to evacuate, officials said.

Gov. Arnold Schwarzenegger declared a state of emergency for San Bernardino County, freeing up state resources to battle the fire.

Erratic winds and low visibility temporarily grounded air support, but helicopters and air tankers took to the skies by Sunday morning aided by about 1,000 firefighters on the ground, some spraying fire retardant gel on structures.

The blaze broke out Saturday afternoon near Lytle Creek, a small community surrounded by national forest. Fueled by thick timber and brush, the fire pushed over hills and canyons by fast-moving winds.

Evacuation centers were set up at a high school in nearby Rialto and at the Victorville Fairgrounds.

The cause of the fire was under investigation.

In Arizona, some residents of the city of Williams remained away from their homes for another day as a prescribed burn that grew out of control threatened the town known as the "Gateway to the Grand Canyon."

Punky Moore, a Kaibab National Forest spokeswoman, said the Twin Fire scorched about 1,000 acres, or more than 1 1/2 square miles, by Sunday morning. It was burning forest undergrowth and ponderosa pines on Bill Williams Mountain.