Kleenex in hand, the retired farmer in the purple plaid shirt perched behind the plaintiff’s table in a rural courtroom and wept as she complained to the judge about her eldest son.

For the last year and a half, 78-year-old Li Lanyu said, she’s been asking him to visit and provide her with grain and cooking oil. “The son has forgotten the mother!” she shouted, burying her face in her hands.

Her son wasn’t there to defend himself. Although he tends a plot of land, he leaves for weeks at a time to toil as a construction worker hundreds of miles away. His wife and daughter told the judge he earns just $166 a month. Visiting more often was possible, the daughter said, but they could afford only a fraction of the food the grandmother wanted.

Until recently, Li Wanglun, 60, may have been a disappointment, even an embarrassment, to his mother in a country where the 2,500-year-old Confucian ideal of filial piety still runs deep. Now, though, he may also be a lawbreaker: A new national statute took effect July 1 mandating that family members attend to the spiritual needs of the elderly and visit them “often” if they live apart.

The “visit your parents” measure is just one component of a multipronged effort by the government and other organizations to remind people to take an active role in their parents’ lives.

Across China, the “visit your parents” measure has inspired applause, derision and a bit of soul-searching: Are the nation’s traditional values and time-honored family customs slipping away so fast, many ask, that they must be encoded in law?

Some younger people believe the government’s campaign is not all altruistic but instead reflects concern about the demands that a swelling population of seniors and a shrinking group of workers will put on state finances. Authorities, they say, want individuals to bear a significant share of the cost of elder care.

There was no immediate ruling in Li’s lawsuit, which was heard in July and widely reported in the Chinese media. It was the first such case to come before a court in Sichuan province. Cases also have been brought in Henan and Jiangsu provinces. In the latter, a judge ordered a woman to visit her 77-year-old mother every two months and on major holidays.

In a nation with a rapidly aging population and families fragmented by migration and the harried demands of modern life, these cases are unlikely to be the last.

Some seniors say an increasingly self-involved younger generation of workaholics needs a stern reminder of its moral obligations.

“This is a good law. Children should never forget their parents, no matter how busy they are,” said an 88-year-old retired factory worker, surnamed Mu, who was taking his daily 6 a.m. constitutional in Beijing’s Ritan Park. “I live with my oldest son, but I have a friend whose kids come back only once a year to visit.”

But 72-year-old Zhang Boxi, who was doing stretching exercises nearby with his wife, Cheng Zunying, 70, said the law, which is vague and doesn’t specify punishments, would be hard to implement.

“How often is ‘often’? Every five days? Every 10 days?” he asked. “What if the boss won’t let you take time to go? It’s not right to use the law to dictate emotional relations between parents and children, or husbands and wives.”

Cheng concurred. “If our two sons stopped visiting us, would we sue them? That’s impossible,” she said, laughing. “Totally impossible.”

Nearly 15 percent of the country’s population — more than 200 million people — is now 60 or older, according to the China Research Center on Aging. Because of increasing life spans and the nation’s one-child policy, China is graying rapidly. By 2053, seniors will make up about 35 percent, or 487 million people, demographers project.

Already, nearly half of the country’s seniors live apart from their children, a phenomenon unheard of a generation ago. Hundreds of millions of young workers from the countryside have migrated to cities for work, leaving their parents behind, and many urban professionals live apart from Mom and Dad.

In recent years, the government has sought to rapidly expand senior medical benefits, and nearly 95 percent of the elderly receive some pension, said Tao Liqun, a researcher with the Gerontological Society of China. An urban retiree may receive $500 to $1,000 a month, but payments in rural areas may be less than $10. “The elderly situation is much better in the cities,” Tao said.

Beyond economic support, seniors need daily care and emotional comfort, Tao said. “The new law will focus some attention on the psychological aspects.”