WATSONVILLE — Baby Sergio’s fever was spiking. His parents had just arrived in this agricultural city from Mexico with no papers, no money, no family, no friends.

The parents tried bringing down the fever, but it didn’t work. The baby started convulsing. An ambulance whisked the terrified young family to a hospital. There, a social worker met with them.

“Don’t worry, señora,” the social worker told Maria as she signed Sergio up for a program called Healthy Kids. She handed the anxious mother an insurance card.

Maria believes that little card saved her son’s life repeatedly over the next several years, allowing him to have regular checkups and paying for crucial surgeries and medical care.

“I am so thankful,” Maria said again and again through tears in a recent interview. “I feel so blessed by what they did for my son.” She requested that her family be identified only by first names because they are in the United States illegally.

A 15-year effort by dozens of California counties to insure undocumented children like Sergio is drawing to a close this summer.

Healthy Kids programs around the state were created to serve children who didn’t qualify for Medi-Cal — the state’s health program for the poor — and couldn’t afford other insurance. But these programs have been rendered largely redundant by a new California law guaranteeing full Medi-Cal coverage to every child in the state whose family income falls below 267 percent of the poverty line, regardless of immigration status.

Before the law was enacted, undocumented children typically could receive only emergency care under Medi-Cal.

Advocates and government officials who fought for Healthy Kids programs say the new guarantee of universal coverage for low-income undocumented kids is a long-hoped-for realization of years of work.

David Brody, executive director of the First 5 Commission in Santa Cruz County, described the “surprise and joy” he and his colleagues felt after the new law passed. First 5, a publicly funded, statewide children’s organization, supported Healthy Kids coverage of children ages five and under in many counties.

“It’s great news for all the communities in the state,” he said. “It’s particularly gratifying for the communities that fought so long and hard to serve those kids.”

The first Healthy Kids program started in Santa Clara County in 2001 to serve children who didn’t qualify for Medi-Cal or other government programs and couldn’t afford private insurance. That was followed by programs in San Mateo and San Francisco counties. The one in Santa Cruz County began in 2004.

At the peak of the initiative, some 28 counties in California had Healthy Kids programs, serving tens of thousands of children. They were paid for by various entities working in concert, including counties, First 5 commissions, state and local foundations, hospital and physicians groups and private donors. But they were never enough to meet the statewide need. Long waiting lists were common in the programs’ early days, and enrollment in some counties was limited to children age 5 or younger.

In 2008, a proposal by former Gov. Arnold Schwarzenegger to cover all the state’s uninsured residents fizzled. Then recession shrank the state’s coffers. Foundations that had funded Healthy Kids programs began directing their money elsewhere.

One by one, the programs began to close. By 2015, only 11 remained.

Those programs fought hard to stay afloat. Brody came to Santa Cruz County in 2013, just as its Healthy Kids program was in danger of shutting down for lack of money. He said a local health insurance plan, hospitals, county leaders, nonprofits and philanthropists banded together to save it.

“There were a few key meetings where powerful voices in the community stood up and said, ‘Let’s find a way,'” he said.

Coverage for children like baby Sergio hung in the balance. Sergio is now 9. During that initial hospitalization, he ended up in a coma, his mother said. He suffered brain damage and paralysis that continue to profoundly affect him.

Maria and her husband pick berries in the fields around Watsonville. Without Healthy Kids, Maria said, there is no way they could afford Sergio’s ongoing medical care, including asthma treatment and visits with neurologists, as well as the two surgeries he has had.

Natali Martinez Hernandez, 16, has been insured by Healthy Kids for most of her life, beginning when she was a small child. Doctors in Mexico had assured her parents that she was fine. But after the family arrived in Santa Cruz, local physicians determined that she suffered from a condition called neurofibromatosis. It causes tumors to form on nerve tissue and requires Natali to go for regular checkups. Her three younger brothers are all U.S. citizens who were born in California, but because Natali arrived when she was 4 months old, she was not eligible for Medi-Cal under the rules in effect at the time.

“It’s very difficult when you arrive here and everything seems fine and then, all of a sudden, it’s not,” said Natali’s mother, Ana Rosa Hernandez.

Counties with still-active Healthy Kids programs say they have worked hard over the past year to help children make a smooth transition to Medi-Cal. Most have either closed their programs, or plan to close them once they complete the transfer of the remaining children.

Because of different income-eligibility thresholds, there is a small group of undocumented children who were eligible for Healthy Kids but not for Medi-Cal — those whose family incomes are between 267 percent and 300 percent of the federal poverty level.

Local advocates say they have tried to help some of these kids get coverage under the Kaiser Child Health Program, which serves low-income children, or to connect them with other providers. But some worry that a small handful of children may not find good alternatives.

Mark Diel, executive director of California Coverage & Health Initiatives, the association of Healthy Kids programs around the state, said a few hundred undocumented children fall into this situation and may lose their health coverage, which he called “really, really unfortunate.”

“But it’s not a large enough pool of people to maintain an insurance program for,” he said.

The three original Healthy Kids counties — Santa Clara, San Francisco and San Mateo — are cutting their programs back but keeping them open through 2019 to comply with a contract they signed years ago in order to receive federal Children’s Health Insurance Program funding.

Most of the undocumented children in those counties are moving to Medi-Cal, said Srija Srinivasan, interim deputy chief of the San Mateo County Health System. Those who remain in the programs are primarily U.S. citizens or legal residents whose families earn too much to qualify for Medi-Cal, but can still qualify for Healthy Kids, which allows slightly higher incomes than Medi-Cal.

“We’re pretty proud to be at this point to have been a small part of the policy change that’s now the law of California,” she said.

Leslie Conner, executive director of Santa Cruz Community Health Centers, worked for years on that county’s Healthy Kids program. She recalled a roofer with a teenage daughter who was having serious mental health issues. The girl had landed in the hospital multiple times, and the bills were adding up.

“He would go out to his mailbox every day and just hope and pray that the letter from Healthy Kids would come saying, ‘Yes, you’re in,'” Connor said.

“Kids like his daughter are covered now,” she said. “And that makes me really happy.”

Ana B. Ibarra of Kaiser Health News contributed to this report. KHN is an editorially independent program of the Menlo Park-based Kaiser Family Foundation.