A house remains standing in front of ash-covered hillsides in Montecito, Calif., on Wednesday. (Frederic J. Brown/AFP/Getty Images)

After weeks of battling flames, fire crews in Santa Barbara County have succeeded in pushing the second-largest wildfire in state history away from thousands of threatened homes, bringing to a tenuous end one of the most destructive years of fire in memory.

A final blast of offshore wind, known as a Santa Ana, faded Thursday to a cool breeze, aiding firefighters’ effort to slow down the spread of the Thomas Fire, which was 60 percent contained Wednesday afternoon. County fire officials lifted mandatory evacuation orders in and around this city set between a coastal range and the Pacific Ocean, allowing about 16,000 people to return to homes some feared they would not see again.

“This has been a nightmare fire,” said Chris Childers, Santa Barbara County fire battalion chief.

A combination of scarce rainfall and extremely low humidity sparked numerous fires across the state this year, from the wine country of Sonoma County in the north to San Diego County in the south. Hundreds of thousands of Californians had to abandon homes, host neighbors and displaced relatives, and strap on masks to block the ash. They spent weeks worrying about the weather, wind direction and the uncleared yards that could fuel flames around their houses.

The severity of the fires this year — one set a record for costliest ever in property damage — has also prompted a reckoning among state and local planners who have allowed building in the dry outskirts of towns and cities for years.

A Cal Fire Inmate Firefighting Hand Crew hikes through the charred landscape during efforts to battle the Thomas Fire near Montecito, Calif., on Tuesday. (Mike Eliason/Santa Barbara County Fire/EPA-EFE/Shutterstock)

Many of those homes are most at risk, as California’s rainy season and fire season blend together with shifts in climate patterns. Hundreds of homes survived this year outside of Santa Barbara and Santa Rosa in large part through the luck of last-minute wind shifts and intensive clearing and aerial bombardment with water and retardant that fire crews carried out in 24-hour shifts.

The Thomas Fire, the blaze that began early this month in the Ventura County city of Santa ­Paula and swept north on heavy, dry winds, has burned more than 272,000 acres. The charred land, much of it backcountry forest and chaparral, makes the fire the ­second-largest in state history.

An estimated 1,800 homes and buildings were destroyed in the Thomas Fire, which is now burning away from populated areas. A firefighter from San Diego County, Cory Iverson, 32, was killed on the fire's eastern edge. He left behind a 2-year-old daughter and a pregnant wife.

While terrifying for many here in recent weeks, the Thomas Fire was only the coda to a year that included the Wine Country fires north of San Francisco, a far deadlier series of blazes that killed 42 people and destroyed 10,000 businesses and homes.

The worst of those blazes scorched eastern Santa Rosa, where city officials and homeowners are deciding now how — or whether — to rebuild in the fire-prone area. State officials say the estimated $10 billion in damages makes the fire the costliest in state history, surpassing the 1991 blaze that burned through neighborhoods in the Oakland Hills.

The fires have also cost state and local governments hundreds of millions of dollars to fight. The expense of the Thomas Fire alone has exceeded $130 million. California members of Congress are seeking at least $4.4 billion from Washington to help with recovery, and House Speaker Paul D. Ryan (R-Wis.) has promised Californians that “we are here to help.”

People here are very familiar with fire, and even some of those evacuated this time have had to pick up and go before. But never for as long as this stretch — six days for many — and never with fires quite so close to such a concentration of homes.

Allan Glaser, a 55-year-old film producer who was opening up his house in Riven Rock again Thursday morning, said he has been forced to leave his home twice previously during fires over the two decades he has lived here.

The Thomas Fire forced him and his partner to evacuate first to a friend’s home in nearby Summerland, then to a downtown hotel when Summerland was closed to residents, then back to Summerland.

“I never thought this fire would get here. I mean, it started in Santa Paula, a place I’ve never heard of,” Glaser said of the town about 45 miles to the south, as he unloaded his SUV. “The flames were a block away. And even though I had been told the house is all right, you need visual confirmation to take away all the anxiety.”

For weeks, residents have been measuring time as the period between Santa Anas, the frightening “wind events” that drive the flames. When a breeze rises, people turn reflexively to look for a flag or banner to determine direction, a tic developed after too much time under fire threat.

City natives say the changes this year have been noticeable in the mountains that serve as a backdrop to the city. Hills that once turned seasonally from summer brown to rich winter green are now covered in ash, a bone-white reminder of the lack of rain. The foothills remain tinder-dry with no rain in sight.

Here in Montecito, the fire burned down the hillsides toward some of the most valuable property along the Southern California coast. In some cases, flames scorched canyons just yards from homes worth millions of dollars.

Bright pink flame retardant, dropped from aircraft, now paint the narrow streets, oaks and eucalyptus. Along Montecito’s most exclusive roads, mansion gates have been wide open for days, allowing firefighters access to the property and to the ridges and canyons above them.

The gates began closing again Thursday as people got word they could move back in. Greg Frank, a CalFire team leader from Shasta County, walked along East Mountain Drive with his small crew. The street, among Montecito’s most beautiful, was at the front edge of the fires this week.

Frank was taking down evidence of the evacuation — pink ribbons around mailboxes that mark an empty property, the hoses, trash and windfall debris from back yards, the cleanup after a long fight.

“We’re just trying to make people feel whole,” Frank said.

An advance party of gardeners, maids and contractors, many of whom had lost days of work, arrived first in Montecito. At the gates of a family home where she has worked for two decades, Juana Garcia said, “I know I’m going to find a lot of ash.”

Patrick Tuliao, a 39-year-old contractor, was at work on a home remodeling job off East Valley Road within an hour of the order being lifted. He gets paid by the day and has spent several days on the edge of the evacuation zone.

“I spent all Wednesday waiting at the roadblock yesterday, drinking coffee and hoping they’d let me in,” Tuliao said. “We’ve never been out of work like this so long.”