HANGZHOU, China — The students were lined up in rows, listening intently as their professor, Li Wei, explained the periphrastic future tense.

Among them were monks with shaved heads, a yoga teacher sitting cross-legged at her desk and a man in a suit who had rushed in late.

In the rat race that is modern China, it is not uncommon for ambitious types to study coding or business English in the hope of getting ahead socially, financially or, ideally, both.

These students were different. At a temple here in Hangzhou, China’s e-commerce capital and a place some call the “city of entrepreneurs,” they were learning Sanskrit, the ancient Indian language in which most Hindu and some Buddhist texts are written. 

It’s a pursuit with no practical application — the Chinese equivalent of studying Latin after-hours in Silicon Valley.

“I just come here out of interest and for some quality time,” said Zhang Weifu, the late arrival, who works as a German translator at a company here. “Hangzhou is booming, but this is a quiet place, and it’s so relaxing to come here and study. Your heart rate slows down.”

Like Zhang, more and more people are looking for ways to wind down as the country speeds up around them. 

During more than three decades of breakneck growth and round-the-clock labor, China has transformed from a relatively poor, mainly agrarian nation into the world’s second-largest economy. The urban middle class, all ambition and conspicuous consumption, now numbers some 400 million people.

But the Chinese economy is beginning to slow. At a little more than 6 percent, its current quarterly growth rate is the weakest in a generation.

Leaders in the new tech economy in particular have urged longer work hours to increase output and take China to the next level.

Jack Ma, founder of the Hangzhou-based e-commerce giant Alibaba, sparked an outcry this year when he advocated the Chinese work practice known as “996” — working 9 a.m. to 9 p.m. six days a week. People who did that, he said, would reap the “rewards of hard work.” 

Another tech titan upped the ante, declaring that the 996 work culture is for slackers. Richard Liu, chief executive of Alibaba’s e-commerce rival JD.com, said he works “8116+8.” That’s 8 a.m. to 11 p.m. Monday to Saturday, then a mere eight hours on Sunday. 

A small number of Chinese have responded by opting out of modern life altogether, retreating to the mountains to live as hermits. 

But others — such as Zhang, or Jenny Li, who works in international trade — have found in Hangzhou’s famed Lingyin Temple a less radical source of respite.

“In this program, I get to slow down and find a deeper meaning, reflect on what is important,” said Li, who has studied Sanskrit for more than a year. She started, she said, partly to develop her consciousness and awareness and partly because she is Buddhist and wants to read religious texts.

She said her friends often ask her why she’s studying something so obviously lacking in earning potential.

 “Sometimes you need to do things for your inner needs,” she said. “For us in the millennial generation, we don’t need food or money as much as we need more spiritual sustenance.”

China’s ruling Communist Party doesn’t make it easy for people to find spiritual sustenance. Especially in the six years since Xi Jinping became president, authorities have clamped down on organized religion.

Christians, Muslims, Buddhists, Taoists — all have found it increasingly hard to practice their faiths. Churches have been shuttered, temples have had to raise Chinese flags, and mosques have been razed or put under surveillance as part of a crackdown on Uighurs in Xinjiang.

But the Lingyin Temple, or Temple of the Soul’s Retreat, is clearly in the party’s good graces. It remains a tourist destination and has been allowed to keep training Buddhist monks and offering Sanskrit classes to the public.

“There are a lot of people who come here because they’re looking for inner peace,” said Jun Heng, the deputy abbot. “They might be addicted to technology or stuck in the rat race or depressed by life. They are living with a lot of stress, so when they are up here with the Buddhist monks, they can find quiet. They are not necessarily Buddhists.”

Despite the growing restrictions on religion, Sanskrit seems to fit into Xi’s wider campaign to promote traditional culture. 

There are some historical links between the ancient tongue and Mandarin Chinese. Mandarin borrowings from Sanskrit include the words for “convenience” and “free oneself of.” One of the Foreign Ministry’s favorite phrases — “wang xiang,” or “delusion” or “wishful thinking” — comes from the Sanskrit word “vikalpa,” found in Buddhist sutras.

Li, the professor of Sanskrit, began teaching at the Lingyin Temple’s Buddhism Academy in 2015. 

The first class was so oversubscribed that fewer than half the 380 applicants could be admitted. They included a 10-year-old, a yoga teacher, an architect and several pensioners. At the beginning, some had to stand. But only 50 made it to the end of the semester, and of them, 20 enrolled for a second. 

About 30 students were in the classroom on the night The Washington Post attended. When the three-hour lesson began, they all had their textbooks out while Li stood at the green chalkboard and drilled them in grammar. While Chinese is a complicated language in that it has four distinct spoken tones and thousands of written characters, it has a relatively simple structure.  

There is nothing simple about Sanskrit grammar. Nouns have three genders, three numbers and eight cases, like German or Latin. 

Then there’s the script, a swirl of loops and lines. 

“It’s a big puzzle, but I think that’s why I like it,” said Zhou Meiying, an electrical engineer in her 40s who’s been learning Sanskrit for three years.

The students repeated the lines after Li and read from their textbooks when called on. It did not seem like a particularly leisurely pursuit.

But the students insisted they found it enriching. Ni Jiajia, 26, described herself as a recluse and said attending the class forced her to get out. Thomas Shen, a 25-year-old law clerk in a Superman T-shirt, simply said it was fun.

“People have different hobbies. Some people might play basketball or play PC games or chase after pop stars,” Shen said. “For me, learning languages is my hobby because I can understand different cultures and how people live.”

And, against the odds, the students are finding some practical uses for their newfound language skills.  

When a group of them visited India together, they were struggling in the heat. So one of them went up to some police officers and asked, in Sanskrit, where to get water. It was as though they were speaking Shakespearean English on the streets of London, but it worked. They got their water.

Lyric Li contributed to this report.