CALABASAS, Calif. (AP) — Authorities cautiously lifted some evacuation orders but warned serious challenges remained Sunday as crews working in thick brush and jagged terrain protected homes and worked around the clock to stop the progress of a brush fire that torched the populated hills northwest of Los Angeles.

Firefighters took advantage of cooler temperatures and calmer winds as they attacked the eastern and southern edges of the blaze, which was held to just over 500 acres, Los Angeles County Deputy Fire Chief John Tripp said.

READ MORE: 'Highway Slingshot Shooter' Fires Ball Bearings at Windows Along San Jose's Guadalupe Freeway

He said it was “our number one priority to get those two flanks contained,” adding that the fire was hung up on the mid-slope of steep canyons, making a direct attack difficult. Hot, dry conditions a day earlier led to spot fires that had crews scrambling, Tripp said.

The fire was 30 percent contained and residents of the prosperous and semi-rural area of Calabasas were being allowed back into their homes, many of which were without electricity. Evacuation orders remained in the hilly enclave of Topanga.

Sheriff’s officials said some 3,000 homes were threatened and about 5,000 residents were evacuated at the height of the fire, which was sparked by a car crash that downed power lines.

Three homes were damaged, but the extent of the damage wasn’t clear, Los Angeles County fire Capt. Keith Mora said. Other buildings, including some at a city park, also were damaged.

READ MORE: 3 East Bay School Districts Go All-In on Student Vaccine Mandates

Fifty-foot-high flames erupted on ridges and embers turned trees into torches Saturday afternoon. The fire flared as Southern California sweltered under temperatures that hit the mid-90s in many places. Sunday’s high in Calabasas was expected to be around 86.

Flames raced through drought-dry brush and came within yards of million-dollar homes. The smoke could be seen across the region and a dusting of ash rained down on neighborhoods more than 30 miles away.

Some horse owners in the area put the animals in trailers and hauled them away.

Authorities set up an evacuation center for people with large animals at Pierce College in Woodland Hills.

MORE NEWS: State-of-the-Art Water Purification Plant Helps Silicon Valley Battle Drought

Around 200 firefighters, aided by bulldozers and water-dropping helicopters were on the scene. Three firefighters sustained minor injuries, officials said.

© Copyright 2016 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.