BEIJING — For decades, China harshly restricted the number of babies that women could have. Now it is encouraging them to have more. It is not going well.

Almost three years after easing its “one child” policy and allowing couples to have two children, the government has begun to acknowledge that its efforts to raise the country’s birthrate are faltering because parents are deciding against having more children.

Officials are now scrambling to devise ways to stimulate a baby boom, worried that a looming demographic crisis could imperil economic growth — and undercut the ruling Communist Party and its leader, Xi Jinping.

It is a startling reversal for the party, which only a short time ago imposed punishing fines on most couples who had more than one child and compelled hundreds of millions of Chinese women to have abortions or undergo sterilization operations.