Firefighters were in the final stage Sunday of surrounding one of the biggest blazes in state history, as a helicopter crashed while returning to pick up more fire retardant and water. Two pilots aboard walked away with minor injuries.

The Day Fire was 95 percent contained, and officials expected to have it fully surrounded by Monday. The blaze has burned 254 square miles of brush and timber since erupting Labor Day.

Progress against the stubborn blaze was marred by a helitanker accident in the Rose Valley area of the Los Padres National Forest, authorities said.

The Sikorsky-64E, which had been flying fire suppression missions under contract to the U.S. Forest Service, crashed around 11 a.m. after returning to a helispot to reload on fire retardant and water.

Click here to read FNC correspondent Adam Housley's reporter's notebook on the fires.

Two pilots were treated for minor scrapes and bruises at a local hospital and released. The plane was heavily damaged, its tail section partially fractured and blades broken apart.

The Forest Service and Federal Aviation Administration were investigating.

"The pilots just climbed out and walked away," said Curtis Vincent, a Forest Service spokesman.

Further details on the accident were not immediately available.

Fire crews spent the day digging fire lines in steep rugged canyons of the Sespe Wilderness, home to local wildlife. Scores of weary firefighters have been leaving the fire front and heading home. About 2,364 remained overnight.

Calm winds and higher humidity at the end of the week slowed the spread of flames as crews built containment lines.

The fire, ignited by someone burning debris, has blackened 162,702 acres mainly in the Los Padres and Angeles National forests, making it the fifth biggest fire in California history. At one point, it threatened the Ventura County communities of Ojai, Santa Paula and Fillmore.

The fire destroyed one rural Lockwood Valley home and damaged another. It also burned a handful of structures that included barns, sheds, an unoccupied cabin and a camping trailer.

Firefighting costs have been estimated at more than $70 million.

Click Here to visit FOXNews.com's Natural Disasters Center.