Firefighters appeared to have gained the upper hand on a blaze that destroyed 36 homes and consumed 5,000 acres near a town known as the "Avocado Capital of America."

The fire, 90 percent contained Wednesday morning, was expected to be surrounded by Wednesday night, authorities said. The blaze did most of its damage in its first few hours Sunday as it exploded in canyons about 40 miles north of San Diego and quickly approached dozens of homes.

On Tuesday, firefighters felled dozens of charred oaks and eucalyptus trees while damage assessment teams stepped over mounds of avocados covered in ash.

Thirteen people, including two firefighters, were injured in the fire. Fighting the blaze cost more than $1.1 million, most of which will be covered by the Federal Emergency Management Agency, authorities said.

The damage included 17 outbuildings, 22 vehicles, one motor home and two fire engines, according to the California Department of Forestry.

More than 500 firefighters remained on the line Tuesday, aided by 11 helicopters. But those numbers were expected to shrink as the fire burned uninhabited areas of the Camp Pendleton Marine Corps Base.

The cause remained under investigation. But authorities believe it began at Evans Ranch, a 25-acre persimmon and avocado grove where the manager and his son burned wood cuttings Friday.

"We're certain this is the area of origin," said CDF fire investigator Tom MacPherson.

But Luis Rueda, 19, said the fire he set with his father "was completely extinguished by 3 p.m."

Peter Lissaman, 70, who moved into his home two months ago, said he watched the fire break out Sunday in an area where people had been burning trash two days before.

"I think somebody is very culpable in this," he said.

Farther north, a 2,400-acre fire in Anaheim Hills was 95 percent contained Wednesday morning and was expected to be surrounded by evening.

The fire erupted Saturday night and was fanned by the fierce, hot Santa Ana winds. One firefighter sprained an ankle fighting it.