A firefighter keeps watch as the Holy Fire burns in the Cleveland National Forest along a hillside at Temescal Valley in Corona, Calif., Thursday, Aug. 9, 2018. Firefighters fought a desperate battle to stop the Holy Fire from reaching homes as the blaze surged through the Cleveland National Forest above the city of Lake Elsinore and its surrounding communities.Ringo H.W. Chiu / ASSOCIATED PRESS

LAKE ELSINORE, Calif. — Aircraft turned hillsides red with retardant as homeowners wet their houses with garden hoses in a battle to contain an arson wildfire, which prompted evacuation orders for more than 20,000 people south of Los Angeles.

Gov. Jerry Brown declared a state of emergency Thursday night for Orange and Riverside counties as a four-day-old fire carved its way along ridges and hillsides of the Cleveland National Forest.

Brown’s proclamation said thousands of homes were threatened by the fire in the foothills above Lake Elsinore and nearby communities and ordered state agencies to help local governments.

Firefighters planned to work through the night to gain ground against the blaze before the expected Friday afternoon return of blustery winds that might drive the flames to new ferocity.

A resident of Holy Jim Canyon in the forest was scheduled for a court hearing Friday on charges that he deliberately set the fire.

Forrest Clark, 51, is charged with arson and other crimes and could face life in prison if convicted. It wasn’t immediately known if he had a lawyer.

Michael Milligan, chief of the Holy Jim Volunteer Fire Department, has told the Orange County Register that Clark had a decade-long feud with neighbours and sent him threatening emails last week, including one that said, “this place will burn.” Ironically, his cabin was the only one in the canyon to survive the flames, the newspaper reported.

This booking video image released by the Orange County Sheriff’s Department shows 51-year-old Forrest Gordon Clark, who was booked into Orange County jail in Santa Ana, Calif., Wednesday, Aug. 8, 2018. Clark was arrested in connection with the so-called Holy Fire, which has burned more than 6 square miles in the Santa Ana Mountains. Clark was booked on suspicion of two counts of felony arson, and one count each of felony threat to terrorize and misdemeanor resisting arrest.Orange County Sheriff's Department /ASSOCIATED PRESS

As flames raged closer to foothill homes on Thursday, some residents ignoring evacuation orders stood in driveways or on top of roofs and used garden hoses to wet down their property as smoke billowed around them.

Joe Rodriguez, 38, used a power washer on his patio in the McVicker Canyon Park neighbourhood.

“Until this thing is barking at my door, I’m going to stick with it,” he told the San Bernardino Sun.

Firefighters fought a desperate battle as huge flames came within yards of some homes, feeding on dense, dry chaparral and propelled by 20-mph (30-kph) gusts. They want to encircle the fire before it can devour neighbourhoods and take lives, as gigantic fires still burning in Northern California have done.

“Our main focus this afternoon was getting everyone out safely,” said Thanh Nguyen, a spokesman for the crews battling the Holy Fire.

Phil Williams, 57, stayed near his home in Brookstone Ranch, an unincorporated community of about 5,000 people. His family and pets evacuated along with most of his neighbours but as a member of the local water district, he stayed to help out.

Late Thursday night, he described seeing 70-foot-tall (21-meter) flames creeping within 150 yards of his large yard.

“It’s all tinder and as soon as the flames hit it, it’s gone,” he said. “You can hear the fire coming. It truly does roar. ”

It's all tinder and as soon as the flames hit it, it's gone. You can hear the fire coming. It truly does roar

Williams, who had cut back brush around the home, said he planned to “wait for the sun’s up, see what’s left. Not much more than you can do.”

“If I didn’t do a good enough job, I’ll just rebuild,” he said. “It’s only sticks.”

Although the fire — named for the canyon where it started — destroyed a dozen cabins after breaking out Monday, fire crews were able to prevent further losses but the fire was still virtually uncontrolled as its growth nullified progress in corralling it.

Wind speeds and temperatures dropped as night fell but gusty winds could pick up again Friday afternoon, the National Weather Service warned.

Meanwhile, two major wildfires — one called the Mendocino Complex Fire that is the largest in California history — were burning more than 100 miles (160 kilometres) north of Sacramento.

Crews turned a corner and achieved 51 per cent containment of the Mendocino Complex — actually twin fires that are being fought together. The fire destroyed more than 100 homes and has blackened an area about the size of the city of Los Angeles.

In the Redding area, the year’s deadliest fire was nearly half surrounded and was burning into remote and rugged forest land but grass, brush and trees there are so dry from years of drought and recent heat that the potential remained for the fire to grow, state fire officials said.

The Carr Fire, as it’s called, killed six people, including two firefighters, and burned more than 1,000 homes. Two other people — a state fire heavy equipment mechanic assigned to the fire and a utility worker trying to restore power near the fire — have died in car accidents.

A man watches as fire races down a hillside towards his home as the Holy Fire burns in Lake Elsinore, California, southeast of Los Angeles, on August 9, 2018. – A man suspected of intentionally starting the Holy Fire on August 6 in the nearby Cleveland National Forest was charged August 9 with multiple felony counts involving arson.Robyn Beck /AFP

The fires all grew explosively in the past two weeks as winds whipped the flames through forest and rural areas full of timber and brush that is bone-dry from years of drought and a summer of record-breaking heat.

Air quality has been another casualty of the fires. A smoky haze stretches from the foothills of the Sierra Nevada mountain range to Sacramento and hovers over the San Francisco Bay Area, with most major population centres in between suffering air quality that’s considered dangerous for children, the elderly and people with asthma or other respiratory conditions.

The smoke even drifted as far east as Salt Lake City in Utah.

The sheer size of the fires is numbing in a state that is still reeling from enormous blazes last year and has yet to hit its historically most dangerous months.

Firefighters had almost contained a huge fire near Yosemite National Park.