The ruins of the Pioneer Cabin Tunnel Tree, a giant, centuries-old sequoia in Calaveras Big Trees State Park in California, after it came down during a storm. (Jim Allday/Associated Press)

The giants outside Dana Smith’s office in Shaver Lake, Calif., are spindly like the neck of a brachiosaurus, so tall that he has to throw back his head to see all the way to the top.

They are 10 majestic ponderosa pines that grew 200 feet over about 250 years, a regal presence that lured Smith to the spot where he runs a business renting vacation cottages a few miles south of Yosemite National Park.

The trees are also dead, marked with bright spray paint by state contractors, destined for a date with a chain saw. They are victims of a massacre, a five-year drought — the longest and worst in state history — that has wiped out 102 million trees in the Sierra Nevada Mountains.

But this ecological tragedy has a silver lining. California is in the middle of a $50 million effort to get rid of tens of thousands of dead trees that threaten roads, power lines and homes. Loggers from across the country are flocking to the state in search of a huge payday from tree-removal companies under contract with the state and a few private firms.

“They’re coming from Iowa, Texas, Florida and Pennsylvania,” Smith said. “They tend to be young, people in really good shape — climbing trees, using chain saws six or seven days a week. It’s been rather fascinating. It’s been quite an experience.”

Assemblyman Ken Cooley (D-Rancho Cordova) looks over a fallen tulip tree at Capitol Park on Jan. 19 in Sacramento. (Rich Pedroncelli/Associated Press)

For this new gold rush, workers need a place to lay their heads, and for a few months last year, they filled Smith’s rental properties, studios to eight-bedroom luxury cottages that rent for $75 to $800 per night.

The jobs are so good and seem so stable that some loggers are uprooting their families from states such as Oregon and Georgia and relocating to California. Ron Henson, a real estate agent who works for Smith at Shaver Lake Vacation Rentals, said he knows some who moved to Clovis, outside Fresno.

As the number of dead trees grew, so did the tree-cutters. They started arriving in a trickle in 2015, when the U.S. Forest Service counted 66 million dead trees. After the mortality skyrocketed to more than 100 million trees and Gov. Jerry Brown (D) attached tens of millions of dollars to an emergency order last year, loggers started arriving in droves.

At least a half-dozen public and private agencies are offering money to clear them away to be used as biofuel or as chips for emergency offramps that help slow runaway trucks.

The California Department of Transportation allocated $11 million to slice away massive trees before they keel over onto two key roads, in an attempt to keep them from blocking busy traffic headed to and from Yosemite or killing a motorist.

“You could easily have traffic on a two-lane road backed up 20 or so miles in both directions,” said Cory Burkarth, a spokesman for the agency, known as CalTrans. “And State Route 41 is the main road in the area. That’s a major concern, what a fallen tree can do to the safety of motorists and passengers. In the middle of the night, you can’t see those trees on the side of the road, and you might not see it fall.”

As of January, CalTrans had identified nearly 30,000 trees it wanted removed along State Routes 41 and 168. The agency pays up to $1,000 per tree, Burkarth said. About 8,000 have been removed at a cost of about $6.5 million.

The Forest Service also is spending millions of dollars to remove trees, as are at least two utilities, Southern California Edison and Pacific Gas and Electric. They are worried about trees that threaten electrical lines that send power to thousands of businesses and homes.

What befell some of California’s most magnificent trees is a haunting story. They slowly parched from thirst, year upon year. Weak and near death, their immune systems, which create sap that helps keep away harmful pests, failed. And when that happened, beetles moved in for the kill.

The western pine beetle was one of several insect species that flourished as they fed, leaving eerie feeding grooves beneath the bark, branding the trees like tattoos. As the trees succumbed, their emerald leaves turned the color of rust.

The scale of the devastation has shocked Forest Service workers who count them and U.S. Geological Survey scientists who perform autopsies — 8 million acres of death across the California mountain forests.

Workers typically count hundreds of dead trees in an area, then move to others. But often, when they returned to the same spots weeks later, trees that seemed fine had died. It took time to realize that beetles were eating the healthy but drought-stricken trees alive under their bark, Burkarth said.

“It’s actually going to take months and months and months to complete the work, as the bugs kill more trees,” said Len Nielson, a forester for Cal Fire, a state agency that battles wildfires.

Fires that race through dead trees are another reason to remove them, officials say.

“This has never happened in California before, not at this level,” Nielson said. “At home, I look out my back door and see thousands upon thousands of dead trees.”

Smith looks up at the trees around his office and sees red, orange and rust — pretty fall colors under normal circumstances, but not in this grim context. In the distance, when workers are in town, he can hear a symphony of chain saws, whistles and shouts, followed by trees cracking and crashing to the ground.

He worries that one of the 10 dead trees nearby might fall before being cut. Any of the behemoths would crush the office.

That is not the only worry. Smith said the young workers who have followed the money to the forest can be reckless — drinking, wandering about at odd hours and making a mess of his property.

Loggers might live and play hard, but they also work very hard. “By many measures, logging is the most dangerous occupation in the United States,” according to a brief on the industry by the Occupational Safety and Health Administration.

OSHA statistics place it among the 10 toughest jobs in the nation. Tools and equipment such as chain saws and logging machines make it extremely hazardous. Workers deal with massive weights and the momentum of falling, rolling and sliding trees and logs.

The jobs are stable for years to come, even though California’s drought appears to be ending, as snow piles up in the Sierra Nevada range and rain pours on arid Los Angeles and Orange counties. Only Santa Barbara County, which relies on a reservoir that has a low water level, is technically still in drought.

Healthy adult trees will absorb the precipitation and strengthen. Young trees are safe from pests because their bark is not ripe and nourishing. And dead trees will keep leaning, keeling over and threatening people, traffic and wires.