Barouk Cedar Forest, Lebanon — Walking among the cedars on a mountain slope in Lebanon feels like visiting the territory of primeval beings. Some of the oldest trees have been here for more than 1,000 years, spreading their uniquely horizontal branches like outstretched arms and sending their roots deep into the craggy limestone. They flourish on the moisture and cool temperatures that make this ecosystem unusual in the Middle East, with mountaintops that snare the clouds floating in from the Mediterranean Sea and gleam with winter snow.

LEBANON Barouk Cedar Forest By The New York Times

But now, after centuries of human depredation, the cedars of Lebanon face perhaps their most dangerous threat: Climate change could wipe out most of the country’s remaining cedar forests by the end of the century.

As temperatures rise, the cedars’ ecological comfort zone is moving up the mountains to higher altitudes, chasing the cold winters they need to reproduce. But here in the Barouk forest, part of the Shouf Biosphere Reserve, south of Beirut, there isn’t much farther up to go. If the climate warms at the rates expected because of the continued rise of greenhouse gas emissions in the atmosphere, some scholars say that by 2100 cedars will be able to thrive only at the northern tip of the country, where the mountains are higher.

In the north, though, there are different problems. Lebanon’s densest cedar forest, the Tannourine Cedars Forest Nature Reserve, has lost more than 7 percent of its trees to insect infestations unknown before 1997. They are directly tied to a warming, drying climate.

A Tannourine forest cedar that died from an insect infestation. Josh Haner/The New York Times

LEBANON Tannourine Cedar Forest By The New York Times

Throughout history, the cedars of Lebanon have been prized for buildings and boats, chopped down for temples in ancient Egypt, Jerusalem and beyond. So while climate change did not start the assault on the cedars, it could be the death blow.

Many thousands of square kilometers of forest once spread across most of Lebanon’s highlands. Only 17 square kilometers of cedars remain, in scattered groves.

The country’s most famous cedar patch, sometimes called the Cedars of God, has been fenced off for preservation since 1876.

Unesco added the Cedars of God to its list of world heritage sites twenty years ago. The forest is isolated, and its ability to expand is limited. Now Unesco says it is one of the sites most vulnerable to climate change.

LEBANON cedars of god By The New York Times

Some believe that patch was where the resurrected Jesus revealed himself to his followers, said Antoine Jibrael Tawk, an author of books on the cedars.

The Lebanon cedar, a distinct species known scientifically as Cedrus libani, grows mainly here and in Turkey. The trees germinate in late winter because they need a freeze, preferably with snow.

This year, winter was mild. Omar Abu Ali, the ecotourism coordinator for the Shouf Biosphere Reserve, Lebanon’s largest protected area, pointed to evidence on the ground in the Barouk forest.

It was early April, and cedar seedlings were beginning to pop up from the soil. Normally the seedlings don’t come up until early May. Earlier, they risk dying in cold snaps and are more vulnerable to insects. “This is early germination,” Mr. Abu Ali said. “They can die.”

Cedar seedlings in Barouk forest. A dead cedar, right, next to a healthy one in the Tannourine forest.

A generation ago, it typically rained or snowed 105 days a year in the mountains. High up, snow stayed on the ground for three to four months. This past winter, there were just 40 days of rain and a only month of snow cover.

“Climate change is a fact here,” said Nizar Hani, the Shouf Biosphere’s director. “There is less rain, higher temperatures, and more extreme temperatures,” both hot and cold, he said.

“The cedar forest is migrating to higher altitudes,” he said. And it is unclear, he added, which of the species that usually live alongside the cedars will survive higher up, further changing the ecosystem.

A 2010 study suggested that if the climate warms at expected rates, no more cedars will thrive in the Shouf, because the mountains there are not high enough. While some Lebanese specialists view that prediction as overly dire, they agree the cedars face an emergency.

Cedars planted about 90 years ago shade a yard southeast of Beirut.

“We are in a race,” said Dr. Hani. “There is no time to lose.”

In the Tannourine reserve, north of Beirut, this year’s poor snowfall has forest managers bracing for a tough season with Cephalcia tannourinensis, an insect commonly known as the cedar web-spinning sawfly that feeds on the trees’ young needles. The insect was unknown to scientists until 1998, when Nabil Nemer, a Lebanese entomologist identified it as the cause of the mysterious blight that hit Tannourine the year before, killing swaths of the forest

Called to investigate, Dr. Nemer discovered that the culprit was the sawfly, which buries itself in the ground in the winter. It had never been noticed before because its life cycle initially did not interfere with the cedars. But with earlier snowmelt, the insects emerged earlier, laying their eggs in time for larvae to eat new cedar shoots.

“We can see a direct climate change effect,” Dr. Nemer said. From 2006 to 2018 alone, he said, the insects killed 7.5 percent of the Tannourine forest’s trees, disproportionately young ones.

The discovery of the sawfly spurred the creation of the Tannourine reserve. To protect the trees, scientists are using new methods to fight the insect with fungi that exist naturally in the forest and can kill the larvae.

The insects are just the latest threat to the cedar, which, like Lebanon itself, has faced one challenge after another: tough terrain, invasion, plunder, conflict.

The cedars are able to survive in a challenging environment. Their roots can drink from springs inside the porous rock. That survival is precisely what makes them a compelling symbol for Lebanon.

Through five millenniums of recorded history, a parade of civilizations has praised the cedars of Lebanon — and then chopped them down. Lebanon has been deforested by Mesopotamians, Phoenicians and ancient Egyptians; by the Greek and Roman empires; by crusaders, colonizers and modern Middle East turmoil. Yet the trees are so symbolic of the country that a cedar stands at the center of the Lebanese flag.

It offers majesty, for a tiny, vulnerable country. Rootedness, for generations scattered by famine and conflict. Ancient history, for a state carved out by colonial powers.

Invaders have long targeted Lebanon for its water supply, its ports and the valuable cedars, which they carted away for their palaces, temples, and ships. For centuries, the steep, rocky mountains attracted minority sects fleeing from hostile neighbors; their goats and wood stoves consumed more cedars. The conflicts of fractious warlords wreak environmental havoc to this day.

In the 1960s and 1970s, Lebanon had a national Green Plan that replanted many cedars. Then came the 15-year civil war. The plan was forgotten. Some warlords protected the cedars, in their way; in the Shouf mountains, Druze militants laid land mines around forests.

Four years ago, Lebanon’s Agriculture Ministry began a new plan to plant 40 million trees, including some cedars. Separately, the Environment Ministry supervises the management of protected cedar areas. Yet even today, political divisions and the war’s legacy make the government too weak and fragmented to build functional national systems for electricity, water delivery, sewage or trash removal, let alone a muscular, enforceable master plan to protect the cedars, ecologists say.

Still, many Lebanese see in the tree a reflection of their land’s uniqueness and its ability to survive the storms of history.

“It is a very strong tree, strong enough to be able to live in very hard conditions,” said Dr. Hani, the Shouf Biosphere director. “It’s very unique, noble, different from any other kind of tree.”

Political posters in Beirut.

Everywhere in Lebanon, the cedar tree can be found on banners, tattoos, storefronts, souvenirs, political posters. It is often a stylized cartoon, like the bright-green stencil on the country’s cheerful flag, a child’s vision of the ideal tree. The trees’ scent surfaces in cedar honey and cedar olive-oil soap. Middle East Airlines paints the tree on its aircrafts’ tails and on their turned-up wingtips, as if to make sure passengers cannot miss the symbol.

Liliane Keirouz, an artist who designs with wood legally harvested from the Cedars of God forest. Cedar trees pictured on coins at the Bank of Lebanon currency museum in Beirut.

Accounts of the cedar go back to one of humanity’s first remembered stories, the epic of Gilgamesh. In the tale, Gilgamesh kills Humbaba, the guardian of the cedar forest, and carries away the trees to build palaces and fortresses. Faisal Abu-Izzeddin, whose book “Memories of a Cedar” chronicles centuries of deforestation, calls Humbaba’s defeat the first of many victories of consumer over conservationist.

The cedars are mentioned repeatedly in the Bible. In the Song of Solomon, they represent the beauty of the beloved: “His countenance is as Lebanon, excellent as the cedars.”

Interested in keeping up with climate change? Sign up to receive our in-depth journalism about climate change around the world.

Some Lebanese even invoke the trees in an oath: ‘I swear upon the cedars.’

In order to protect the cedars from total destruction, various Lebanese conservation groups are trying to diversify their locations and expand their populations. The main goal of replanting, they say, is to make the cedar forests larger and more resilient to whatever future environmental pressures they face.

Young cedar trees in a nursery.

The ideal altitude for cedars has historically been between 1,400 and 1,800 meters. But some trees can survive higher or lower, depending on water, shade, soil and wind. Experimenting, conservationists have found seedlings can survive in some places up to 2,100 meters.

In Arz, the Cedars of God reserve has just 2,100 trees. Dr. Youssef Tawk, a medical doctor and conservationist, and his colleagues are trying to regenerate a larger forest. It’s a challenge because the reserve itself is isolated. Most of the ideal areas to plant are private, or designated for other uses by the municipal government.

But since 1998, Dr. Tawk’s group has planted 100,000 trees in a patchwork of disconnected lands around the old reserve.

Rows of replanted cedar trees on a mountain above the Cedars of God.

“It was a lot of trial and error,” Dr. Tawk said. “Where we could, and where the municipality allowed, we planted.”

Cedars grow slowly, bearing no cones until they are 40 or 50 years old. When they are young by cedar standards, they look much like other conifers, pointy, like Christmas trees. But after about a century, they morph into their distinctive shape. The trunk thickens, the branches spread parallel to the ground, the cones perch atop them like resting birds.

Approaching cedar forests, often the first trees you see are young. They look deceptively ordinary.

Then you come around a bend. The experience can be almost disorienting, because the mature cedars are so unlike how you expect a tree to look. Some stand alone like statues. Others grow in clusters, the horizontal lines of branches crosshatching the verticals of trunks, steep slopes and cliffs, creating dizzying effects.