In the next three to five years, Mr. Kyhl said, virtually all of Colorado’s lodgepole pine trees over five inches in diameter will be lost, about five million acres. “Already in many places, every lodgepole over five inches is dead as far as the eye can see,” he said.

Image HARDY The beetles inject a fungus to stop the tree from moving sap. Many forests are being cut before the trees fall. Credit... Anne Sherwood for The New York Times

Foresters say the historic outbreak has several causes. Because fires have been suppressed for so long, all forests are roughly the same age, and the trees are big enough to be susceptible to beetles. A decade of drought has weakened the trees. And hard winters have softened, which allows the beetles to flourish and expand their range.

Hoping to keep their forests from completely dying, to earn money by selling dead and infected trees and to mitigate fire risks, landowners are scrambling to cut the pines. If enough are cut  up to 75 percent  it might leave some behind that, with less competition for water, can survive. Still, for many landowners, cutting most of the forest where they have they built their homes is painful. “I’ve literally had people in my office crying,” said Gary Ellingson, a forestry consultant for Northwest Management.

The black, hard-shelled beetle, the size of a fingertip, drills through pine bark and digs a gallery in the wood where it lays its eggs. When the larvae hatch under the bark, they eat the sweet, rich cambium layer that provides nutrients to the tree. They also inject a fungus to stop the tree from moving sap, which could drown the larvae. That fungus stains the wood blue.