Ana Elsy Ramirez Diaz holds her son, Milan Rojas Ramirez, during a checkup with Margaret-Anne Fernandez at INOVA Cares Clinic for Children in Falls Church, Va. The clinic’s patients include youngsters covered through the Children's Health Insurance Program, which had its federal funding expire in late September. (Matt McClain/The Washington Post)

The short-term spending plan allowing the government to reopen solves a funding crisis in a public health insurance program for children of working-class families that is popular with Republicans and Democrats alike, but has been ensnared for months in partisan budget fights.

The spending bill that the Senate and House adopted Monday, and that President Trump signed, provides six years of federal money for the Children's Health Insurance Program, a bipartisan creation that furnishes coverage to nearly 9 million children and 375,000 pregnant women.

The budget for CHIP, as it is known, ended on Sept. 30 without lawmakers having reauthorized it as they had done several times over its two decades — usually months in advance of the deadline.

States, which share responsibility for CHIP, had been running short of federal funds for their programs at different paces. Connecticut became the first to freeze enrollment just before Christmas, and at least five states notified families that they would need to do so soon. Eleven other states were expecting to run out by the end of next month.

The measure approved Monday will ward off that escalating drama, providing about $124 billion through 2023. For the first two years, federal money will pay for at least 88 percent of the program's expenses in every state — keeping a heightened federal match that was part of the Affordable Care Act. After that, the federal share will decrease over two years to its level before the 2010 ACA.

Word of the resolution elated state officials, who have agonized for months over the possibility of closing CHIP to new children, as Connecticut did, or reducing or ending benefits for youngsters.

"I am in­cred­ibly grateful and happy that . . . this nightmare is over for CHIP," said Linda Nablo, chief deputy director of Virginia's Medicaid and CHIP agency. The agency sent letters on Dec. 12 to nearly 43,000 participating households, which included about 1,100 pregnant women, that there was a chance their coverage could be affected.

Nablo said state officials' most recent calculation was that, even with help from a short-term spending bill Congress adopted in December and money reshuffled from a separate federal fund, their CHIP money would last only until the end of February.

Even with CHIP money about to flow again, the 114-day interval since its last budget ended has been damaging, she said. "It just stymies positive, forward movement" within the states' programs and may have caused some families to become cautious about enrolling their children. Still, she said, "this is great news."

Joan Alker, executive director of Georgetown University's Center for Children and Families, agreed. "It's a relief to the families that rely on CHIP for their kids' coverage and for states that have been walking a tightrope for months trying to balance their budget," she said.

The funding deal was "very long overdue," Alker said. "It's very damaging to have [the uncertainty] hanging out there that long."

CHIP has had support from across the ideological spectrum dating to its original sponsors, Sens. Orrin G. Hatch (R-Utah) and Edward M. Kennedy (D-Mass.). The program was created as part of a large balanced-budget plan. To comfort conservatives who feared a major expansion of the federal role in health insurance, states were given substantial discretion over how to carry it out. And to comfort states worried about shouldering a big new expense, the federal government from the outset shouldered a greater share of the cost than in Medicaid, the federal-state insurance for the poor.

In the fall, Republicans proposed a spending plan with five years of CHIP funding. But Democrats who support CHIP resisted because GOP lawmakers wanted to pay for the extension through spending cuts, including to the ACA and Medicare.

For nearly five months, lawmakers of both parties rued that CHIP's budget had lapsed, with each side trying to claim the high ground in urging their colleagues to restore the funding.

The partisan rancor persisted after the adoption Monday of the government spending plan. Sen. Dean Heller (R-Nev.) issued a statement chiding Democrats for having previously objected to a GOP bill providing "care for this country's most vulnerable children." Rep. Gerald E. Connolly (D-Va.) said in a statement that "it is particularly telling that Republicans view the authorization of CHIP and the provision of healthcare for children as a concession to Democrats."

The spending plan does not provide financial relief for other important health programs — the nation's community health centers or the National Health Service Corps, which provides scholarships and loans for students planning careers in primary-care medicine.

For now, the federal agency that provides grants to 1,400 health centers across the country is giving prorated amounts through March.

"We implore Congress to approve long-term funding" for both of these programs, Georges S. Benjamin, executive director of the American Public Health Association, said in a statement Monday. "How can our country respond to emergencies like the current influenza outbreak and opioid crisis when we don't know if public health agencies will have funds to pay staff, buy supplies, and keep the lights on and doors open?"