SACRAMENTO, Calif. (AP) — The long and brutal 2017 wildfire season is stressing the state and federal agencies that have to pay for the army of ground crews and machinery required to fight them.

The federal government spent more than $2.7 billion on firefighting in its most recently finished budget year, a record that far surpassed the previous high point of $2.1 billion set just two years ago.

In California, firefighting costs have already chewed through more than half of the state's $469 million emergency fund for big fires just three months in — and that doesn't include the costs of the recent catastrophic fires that have claimed dozens of lives and thousands of buildings.

California officials said Friday they expect the cost of fighting those fires will be hundreds of millions of dollars.

Montana also struggled to pay for firefighting this year, with costs approaching $400 million by late September.

With pressure increasing on lawmakers and forest managers to find new ways to pay for firefighting and for fire prevention, here's a look at some of key questions:

WHY ARE COSTS GOING UP?

The U.S. is seeing more and bigger wildfires, and the wildfire season is getting longer. The reasons are hotter, drier weather and a buildup of dead and dying trees because of past fire-suppression practices, said Jennifer Jones, a spokeswoman for the National Interagency Fire Center, which coordinates firefighting nationwide.

The old practice of putting out all fires led to overgrown forests, some with huge tracts of trees that died at about the same time, leaving them prone to large, hot, fast-moving blazes, researchers say.

Some climate and forestry experts say global warming is a factor in the increasing number of fires because it's contributing to the hot, dry weather.

(AP Photo/Jeff Chiu, File)

Jones said another development driving up costs is the increasing number of homes being built in or near forests, a number that the Forest Service estimates is about 43 million homes. Keeping fires away from people, houses, power lines and other infrastructure is more complicated and costly than firefighting in the wilds.

WHO PAYS TO FIGHT FIRES?

The federal government, most states and some local agencies have firefighting budgets. Who gets the bill for any one fire depends on where it starts and whether it burns on land owned by the federal government, a state or local government or a private individual.

The U.S. Forest Service is the nation's primary wildfire-fighting agency, but the Interior Department also pays hundreds of millions of dollars a year in fire costs.

Before 2000, the U.S. government's firefighting costs never reached $1 billion. Since 2000, they have topped $1 billion 14 times, and they exceeded $1.5 billion 10 times, according to Forest Service records.

Many fires burn across public and private lands. When that happens, everyone involved negotiates a cost-sharing deal, sometimes leading to disputes. In July, California accused the federal government of stiffing the state $18 million for fighting fires on federal land. The Forest Service said it had paid $14 million of that and was trying to resolve differences over the rest.

WHERE DOES THE MONEY COME FROM?

The Forest Service budgets firefighting money each year, based on the average spent over the most recent 10 years. That was about $1.9 billion in the budget year that just ended.

Because fires are getting worse, they are eating up a bigger and bigger chunk of the overall Forest Service budget. In 1991, it was 13 percent; in 2017, it was 57 percent, Jones said.

California officials say they have more flexibility than the federal government. CalFire, the state firefighting agency, has a $1 billion firefighting budget in addition to the $469 million emergency fund for big fires.

"We will not run out of money to pay for these fires that threaten people's lives and property," CalFire spokeswoman Janet Upton said Thursday. "Our incident commanders out there on all these 21 fires today, they're not thinking about the checkbook. They're thinking about protecting life and property."

(AP Photo/Jeff Chiu, File)

WHAT HAPPENS WHEN COSTS GO OVER BUDGET?

The Forest Service dips into other programs, leaving less money for activities like clearing out dead and diseased trees that could help reduce the number and size of fires, Jones said.

Other programs suffer, too, including recreation and habitat for fish and wildlife, she said.

The Forest Service firefighting budget ran about $500 million over in the most recently finished budget, about 25 percent more than what was set aside.

IS THERE A BETTER WAY TO PAY FOR FIREFIGHTING?

The Forest Service and its parent agency, the Department of Agriculture, have long argued that big wildfires should be treated like hurricanes, floods and other natural disasters and be paid for out of the federal Disaster Relief Fund. That would stabilize the Forest Service budget and help preserve money for fire-prevention programs.

Many members of Congress agree — but they disagree on how to go about making the change.

Two bills are before Congress to fix the funding. Both would pay for at least some big fires from the Disaster Relief Fund. But one also calls on the Forest Service to manage its woodlands more actively, including thinning dense stands of trees and removing dead trees in an effort to reduce fires. Some argue that pushing management practices is unnecessary and ineffective.

___

Elliott reported from Denver.