A huge wildfire in northeast California has run up a firefighting tab in excess of $50 million and become the second priciest blaze in the state this year, officials said.

The King Fire east of Sacramento has cost some $53 million to fight since it began nearly two weeks ago, California Department of Forestry and Fire Protection spokesman Daniel Berlant said.

"It takes a lot of resources to fight a fire of this magnitude," Berlant said. "Protecting those people and their property is a huge priority for us. So, until we get a good amount of containment, we will have enough crews assigned until we can stop this blaze."

The figure ranks behind the $86 million that has been spent to tame a still-burning fire in Klamath National Forest along the California-Oregon border.

However, those figures are nowhere near the more than $127 million spent to stop the Rim Fire last year in Yosemite National Park, Berlant said.

Nearly 8,000 firefighters are currently battling the King Fire that has burned 145 square miles and stretched into Nevada. Flames have destroyed 12 homes, and another 21,000 structures — half of them homes — were threatened.

Evacuees from Swansboro, a mountain community of about 400 homes, were allowed to return Wednesday night. Some 2,800 people overall had been evacuated from the fire since soon after it began, but it wasn't immediately clear how many remained.

The fire is nearly 40 percent contained.

Last week, Gov. Jerry Brown declared a state of emergency involving the fire, a move that freed up funds and federal grants.

Firefighters from as far as away as Alaska and Florida have worked alongside California counterparts to establish and strengthen containment lines. Most crews from out of state stay up to two weeks, while crews from across California stay as long as three weeks.

"This continues to be the highest priority fire in the nation and that necessitated the need for reinforcement," state Battalion Chief Scott McLean said. "It is not stretching us thin. We have a lot of resources to draw from throughout the state and across the country if needed."

The King Fire is one of nearly 5,000 wildfires in California this year, a 26 percent increase compared to an average year of about 3,900, Berlant said.

One firefighter was hit by a tree limb Wednesday and taken by helicopter to a hospital where he will most likely be kept overnight for observation, Berlant said.

----

Associated Press Writers Terry Collins and Sudhin Thanawala in San Francisco contributed to this report