For centuries, Swiss farmers have sent their cattle, goats and sheep up the mountains to graze in warmer months before bringing them back down at the start of autumn. Devised in the Middle Ages to save precious grass in the valleys for winter stock, the tradition of “summering” has so transformed the countryside into a patchwork of forests and pastures that maintaining its appearance was written into the Swiss Constitution as an essential role of agriculture.

It has also knitted together essential threads of the country’s modern identity — alpine cheeses, hiking trails that crisscross summer pastures, cowbells echoing off the mountainsides.

In December, the United Nations heritage agency UNESCO added the Swiss tradition to its exalted “intangible cultural heritage” list.

But climate change threatens to scramble those traditions. Warming temperatures, glacier loss, less snow and an earlier snow melt are forcing farmers across Switzerland to adapt.

Not all are feeling the changes in the same way in a country where the Alps create many microclimates. Some are enjoying bigger yields on summer pastures, allowing them to extend their alpine seasons. Others are being forced by more frequent and intense droughts to descend with their herds earlier.

The more evident the effect on the Swiss, the more potential trouble it spells for all of Europe.

Switzerland has long been considered Europe’s water tower, the place where deep winter snows would accumulate and gently melt through the warmer months, augmenting the trickling runoff from thick glaciers that helped sustain many of Europe’s rivers and its ways of life for centuries.

Since he started studying the Rhône Glacier in 2007, Daniel Farinotti, one of Europe’s premier glacier scientists, has seen it retreat about half a kilometer, or about a third of a mile, and thin, forming a big glacial pond at its base.

He has also seen the glacier — which stretches around nine kilometers, or about five and half miles, up the Alps near Realp — grow black as protective winter snow melts to reveal previous years of pollution in a pernicious feedback loop.

“The darker the surface, the more sunlight it absorbs and the more melt that’s generated,” said Mr. Farinotti, who teaches at ETH Zurich and who leads a summer field course on the glacier.

To get to the glacier from the road, his students walk across mounds of white tarps, stretched around an ice cave carved for tourists. The tarps can reduce annual melting by as much as 60 percent, but they cover only a minuscule portion of glaciers, and in places like ski slopes, where there is a private financial motivation.

“You cannot cover an entire glacier with that,” said Mr. Farinotti, who also works for the Swiss Federal Institute for Forest, Snow and Landscape Research.

The government is trying to address the changes and preserve Swiss alpine traditions, including with large infrastructure projects to bring water to the top of mountains for animals grazing in the summer months.

For now, the traditions, while strained in places, continue. After three days of scrambling over rocky mountainsides and zigzagging stone steps, the first sheep in a giant herd of nearly 700 burst into view at the end of their “summering” last fall.

As a crowd of spectators cheered, some of the sheep pranced. Others stopped dead in their tracks and had to be coaxed along by herders in matching plaid shirts and leather cowboy hats, adorned with wildflowers and feathers.

The sheep had been living wild for more than three months — wandering around a high, vast wilderness penned in by glaciers. Their only contact with humanity had been the visits of a single shepherd, Fabrice Gex, who says he loses more than 30 pounds a season walking the territory to check on them.

“I bring them salt, cookies and love,” said Mr. Gex, 49.

To take them back to their owners, who are mostly hobby farmers, he was joined by a crew of herders — known locally as “sanner” from the Middle High German samnen, “to collect” — who arrive by helicopter.

The job is rough and paid modestly, but locally it is considered an honor to take part in a tradition first recorded in 1830, but that many believe started centuries earlier.

“To be a sanner gives you roots,” said Charly Jossen, 45, enjoying a beer with many of the spectators after completing his 11th season in the fall. “You know where you belong.” He had brought his son Michael, 10, for the first time.

Historically, the sanner would take the sheep across the tongue of the Oberaletsch Glacier. But the retreat of the glacier has long made that route too unstable and dangerous. In 1972, the community of Naters blasted a path into a steep rock face to offer the herders and sheep an alternative way home.

This season, the herders intend to push their return back by two weeks, said their leader, André Summermatter, 36.

“With climate change, our vegetation period is longer,” he said, standing in the ancient stone pen where the sheep are corralled at the end of their trek. “So the sheep can stay longer.”

The tradition of alpine pasturing, or “transhumance,” spreads all across the Alps, including Austria, Italy and Germany.

Nearly half of Switzerland’s livestock farms send their goats, sheep and cows up to summer pastures, according the last thorough study done by government scientists, in 2014.

More than 80 percent of alpine farm income comes from government subsidies — many for keeping the pastureland clear of encroaching trees, which are nudging uphill with warmer temperatures.

That makes Switzerland a rare country that does not embrace tree cover as a solution to climate change.

“It would be all bushes and forest if we weren’t here,” said Andrea Herger, herding cows past an inn for hikers and into her family’s milking barn halfway up a mountain near Isenthal. “It wouldn’t be that open, beautiful landscapes for hiking.”

Her husband, Josef Herger, is the third generation in his family to run their alpine summer farm, which is reached by a private cable car. They bring up seven cows from their own farm and 33 cows from neighbors, who pay them in cows’ milk that the couple uses to make cheese.

Farther west, near L’Etivaz, the Mottier family pushes 45 cows along what they call a “mountain train,” following the newly sprouting grass to a summit of 2,030 meters, or more than 6,600 feet, and then back down to nibble on the second growth of grasses. Starting in May, they make five trips, stopping at three levels.

Near the peak, Benoît Mottier, 24, climbed onto a limestone outcrop, decorated with the initials of idling shepherds and the years they carved them. The oldest he can find was left in the 1700s by someone with his initials — B.M.

He is the fifth generation in his family to take cows there.

The Mottiers are one of 70 families in the area who make a traditional Swiss cheese called L’Etivaz. They follow strict rules — slowly heating fresh milk in a giant copper cauldron over a fire of spruce wood. After the cheese is pressed, they take it down to a local cooperative, where it is aged and sold.

L’Etivaz can be made only on the local mountainsides for six months of the year. The tradition is so important, children from local farming families can leave school on summer vacation weeks early to help out.

“At the beginning of the season, we are happy to begin,” said Isabelle Mottier, Benoît’s mother. “At the end of the season, we are happy it’s ending.”

“For us, it’s a life of cycles,” she said.

The Mottier summer farm gets water from a spring. Droughts in recent years have forced the family to adapt.

“A cow drinks 80 to 100 liters of water a day,” Ms. Mottier explained. “We have more than 40 cows. We need an enormous quantity of water.”

In 2015, during a heat wave, the spring ran dry. Three years later, another heat wave and drought hit. And then again in 2022.

During the droughts, the Swiss Army delivered water to alpine pastures using helicopters. The Mottiers, however, had no tanks to store it.

So they have installed a solar-powered pump to draw water from a lower spring, and have purchased a large water bladder to store snowmelt early in the season.

The situation is expected to get worse as the glaciers retreat. The country’s biggest glaciers, including the Aletsch and Rhône, are projected to shrink by at least 68 percent by the end of the century.

In anticipation, the Swiss government has quadrupled funding for alpine water projects. In 2022, it approved 40.

Near the village of Jaun, a construction crew was laying pipes to deliver electricity and water from a new cistern to six local farms. In 2022, some families brought their herds of cows down the mountain a month early because of the drought and heat.

In other regions, warmer temperatures are making fields more productive, said Manuel Schneider, a scientist with Agroscope, the Swiss government’s national research institute, who is leading a five-year study on biodiversity and alpine pasture yields.

That variability, however, can occur even on a single mountain, he said. Farmers with mobile milking stations can take advantage of this “small-scale heterogeneity” by taking their cows — and their milking machines — to less dry areas.

“When the climate is changing, you need flexibility,” Mr. Schneider said.

In the Italian alps, near Sankt Ulrich, Thomas Comploi’s family has won the climate change lottery.

Like many alpine farmers, he uses some of his land to produce only hay; it is too steep for cattle to graze. Today, his fields are growing twice as much grass as they did some 15 years ago.

The provincial government of Bolzano-South Tyrol gives him subsidies for avalanche prevention as well as land management, he said.

“All this would be gone without farmers. — it would be covered in forest,” said Mr. Comploi, 48, who works at the local cable car company in winter.

He added, “We are keeping the tradition going — the passion and the way of life.”

In Swiss alpine communities, the final descent at the end of summer is a celebration of that centuries’ old way of life. Families replace the small bells on their cows with giant traditional ones to herald the event.

“When you put on the big bells, they know they are going down,” says Eliane Maurer, chasing after a young cow wandering off the thin step trail, switch-backing down the mountainside from Engstligenalp.

Her family is one of a dozen that take about 450 animals up to the pasture for the season. They stagger their descent in shifts, so as to not cause bottlenecks.

Ms. Maurer and her family were the second to leave, before sunrise.

They walked under a full moon. The sound of cow bells echoing off the surrounding mountains was thunderous.

Paula Haase contributed reporting from Hamburg, Germany; Elise Boehm from Bologna, Italy; and Leah Süss from Zurich and Belalp.