MARSHFIELD — Mya Barry was born in April 2011 with opiates already coursing through her tiny veins. But it was not the heroin passed to her in utero by her drug-addicted mother that killed the infant, prosecutors say.

Instead, it was the heroin-tainted milk bottle her parents allegedly handed her five months later in their overcrowded and squalid apartment in this South Shore town. Now the parents, Ryan Barry and Ashley Cyr, are charged with manslaughter for the 2011 death. They pleaded not guilty last year and the criminal case is pending in Plymouth Superior court.

No matter the outcome of the case, Mya’s brief life and untimely death point to weaknesses in a social services system that is struggling to deal with the region’s booming addiction to prescription and illegal drugs — a plague that has besieged hospitals with drug-exposed newborns and overwhelmed state social workers for the past five years.

Some 1,300 babies in Massachusetts – about three to four each day — were born in 2012 with what is called “neonatal abstinence syndrome,” suffering withdrawal pains as a result of exposure to illegal opiates such as heroin or prescription drugs such as Oxycontin or methadone, according to a first of its kind survey of local hospitals.

There is no statewide data from earlier years for comparison, but anecdotal evidence suggests the number of cases is exploding. At South Shore Hospital in Weymouth, where Mya died, the number of drug dependent babies rose from 33 in 2008 to 115 in 2013, according to hospital data. UMass Memorial Medical Center in Worcester treated about 60 drug-exposed babies last year, double the number in 2008, a hospital official said. And doctors from Boston and Lowell also say the number of drug exposed-babies has soared.

They are the tiniest victims of the region’s growing opiate epidemic. On Thursday, Governor Deval Patrick declared a public health emergency to combat the increasing abuse of opiates, directing that all the state’s police, firefighters, and other emergency personnel be equipped with a drug that can quickly reverse heroin overdoses.

“We have real concerns about these extremely vulnerable newborns,’’ said Gail Garinger, head of the state’s Office of the Child Advocate. “Unfortunately, with some families there are not enough supports that can be put in place to keep their infants safely at home.”

The increase in drug dependent babies — whose withdrawal symptoms include stiff limbs, sweats, and uncontrollable crying — has hospitals scrambling to care for them. Physicians say there are no federally approved medications or standard procedures to follow, so hospitals care for vulnerable patients as best they can with a variety of treatments. But a potentially bigger danger awaits the children when they leave the hospital.

Most of these high-risk infants go back to the mothers — and sometimes fathers — who caused their drug problems in the first place, according to local doctors who treat opiate-exposed infants. Mya’s story prompts serious questions about whether the state’s social services agency is doing enough to protect children from drug-afflicted parents.

The state Department of Children and Families, which learned about Mya from hospital workers, declined to discuss the infant’s case. But state records, released to the New England Center for Investigative Reporting, show DCF sent Mya home to her father and grandmother, even though they knew her heroin-addicted mother would visit. Although social workers checked on the baby regularly, they apparently failed to see what witnesses described as a rapidly deteriorating situation at the home.

Assistant Plymouth County District Attorney Frank Middleton said in the parents’ arraignment in October last year conditions in Mya’s home made it “almost inevitable” that her life would be cut short. Witnesses, he said, told investigators the parents appeared to be doing drugs daily and had trouble caring for Mya and her two older sisters, ages 3 and 4, though Ryan Barry’s attorney denied in court that his client used drugs while Mya was in the home.

Mya did not even have a crib to sleep in.

Mya’s great uncle Jeffrey Pinkham still wonders why state social workers assigned to protect her left the newborn in what was described by prosecutors as a dirty, cluttered apartment with parents who struggled with addiction.

“They knew how addictive the drug is. They should have been at the house every other day,’’ said Pinkham, 60. “If somebody was there checking on them, why would she have died?”

Dangers at home

Even before Mya drew her first breath, she was in danger.

Her mother Ashley Cyr, 26, did not know she was pregnant until six months into her term – yet that knowledge did not cause her to alter her daily heroin habit, according to Middleton’s court statements.

After her birth, Mya spent six weeks in the hospital being weaned from the opiate. Doctors gave her morphine, a drug used to help infants gradually detox, court records show.

Hospital workers – as required by law — notified DCF that Mya was born with drugs in her system, one among thousands of reports of abuse or neglect against newborns filed in Massachusetts each year.

Nonetheless, most drug-exposed children like Mya return to their families, said Robert Sege, medical director of the Child Protection Team at Boston Medical Center.

At Boston Medical Center, which treated 106 children last year who suffered drug withdrawal, about 85 percent return to their parents, he said. Most of them were exposed in utero to methadone or buprenorphine, drugs commonly prescribed for those in treatment for addiction.

Many parents work hard to fight their addictions and get better, he said. Unfortunately, Sege’s own hospital data shows that a large portion — more than a third of parents — end up relapsing. Within a year, their children are often sent to foster care.

Sege said state social workers need to continuously monitor these troubled families because when parents relapse, children are more likely to be neglected, found wandering alone, unclean, or hurt. Boston Medical Center also has seen children die of abuse or neglect after returning home, he said, although he could not provide numbers. Sege said families need more support when they leave the hospital.

Social workers investigate the home life of each child identified as born drug-exposed, but Sege said too often they close cases for these fragile children and families quickly.

“I don’t think the answer is to take all the babies and put them up for adoption,” he said. “Our feeling is that DCF should have a policy that they should keep these cases open for six months of life."

DCF officials said they are trying to do a better job managing the “explosion” of drug-addicted babies statewide. In January, the agency launched a new training program to teach managers how to identify addiction in adults and recognize when the children of substance abusers are at risk, according to Kim Bishop-Stevens, DCF’s substance abuse manager. “The problem is growing across the country,” Bishop-Stevens said. “It is becoming more and more of a challenge.”

Before letting a drug-exposed child go home with drug-using parents, state officials say they review the home situation, including housing, family supports, and whether a parent is getting help.

“We would have to have a very solid plan if the mom was actively in treatment,” said Christina Joyce, acting deputy commissioner of clinical and program services at DCF. “Basically, it is a safety decision.”

Social workers also have started gathering more information about what happens to substance-exposed newborns after they get home in an attempt to provide better services, which the state’s child advocate, Garinger, called a good start.

DCF has been under intense scrutiny since December following the disappearance of 5-year-old Jeremiah Oliver, who is still missing and feared dead after social workers allegedly failed to check on him for months. In response, the governor commissioned a Washington-based advocacy group, the Child Welfare League of America, to review the agency.

An initial report, released this month, said the state needs to reduce social workers’ caseloads and upgrade technology, among other improvements, to adequately supervise the 36,000 children under its supervision.

But child advocates such as Laurie Myers, founder of Community Voices, a Chelmsford-based advocacy group for child abuse victims, said problems go beyond caseloads. The state child welfare law states that its first priority is “strengthening and encouragement of family life,” and Myers said social workers often try to keep dysfunctional families together even when it puts the children at greater risk.

In cases involving drug-exposed babies, she said DCF should have distinct and more detailed guidelines to address the children’s specific long-term needs and determine when to pull them out of a precarious situation.

“There was nobody looking out for Mya,’’ she said. “We have to start protecting kids first.”

Representative Sheila C. Harrington, a Republican from Groton, recently filed legislation to make the child’s best interest — not family reunification — the top priority of the child welfare law. She believes that change would make tragedies like Mya’s less likely to occur.

Leaving Mya with her drug-addicted parents “was the most negligent thing they could have done,” Harrington said.

Mya’s mother admitted to state officials that she had been using heroin while she was pregnant, according to a DCF report released to the New England Center for Investigative Reporting. But DCF officials decided to let Mya go home with her father and grandmother on condition that Cyr, the mother, would have no “unsupervised” time with her children, the report said. Essentially, that meant that she would not be left alone with her children, family members say.

But child welfare experts say there is an inherent weakness in placing at-risk children with relatives, who may be unable or unwilling to shield children from drug-addicted parents. Currently, more than 50 percent of children in DCF foster care are placed with relatives, according to DCF.

“Social services are so overstretched. How do you ever monitor, pay close enough scrutiny to these families so something like this doesn’t happen?” asked Barry Lester, professor and director of the Brown Center for the Study of Children at Risk at Brown University and Women & Infants Hospital in Providence.

Prosecutor Middleton said in court that Mya’s parents repeatedly lied to a social worker about the fact that Cyr was living at the home.

Mya’s grandmother Debra Pinkham said in an interview that Cyr ended up essentially staying with the family, but other adults were always in the house. She said the social worker was well aware of how many people – nine – lived in the small two-bedroom home. Pinkham also said the house was not filthy, as prosecutors claimed, merely packed.

“They knew that Ashley would come to visit, as far as how long she stayed, I don’t know how much they cared,’’ she said. “We were doing exactly what they told us to do.”

Pinkham, a 56-year-old Dunkin Donuts waitress, said her son Ryan had showed up at her door after Mya’s birth, his two older girls in tow. She could not turn them away. She gave them one of the two bedrooms, the other was used by her adult daughter, her daughter’s husband, and their small child.

Pinkham said she knew that Ashley was using heroin. She also suspected her son was using, even though he denied it. Still, she felt the family was functioning— Ryan still cared for the kids; Pinkham helped out.

She now wishes she had taken her son’s three children, including the baby, and escaped before everything fell apart. “I know I made the biggest mistake of my life by trying too hard to help everybody,” Pinkham said. “We are not bad people. We are just people who have been struggling with this.”

Peter MacKinnon, a long-time social worker and president of the DCF chapter of the Service Employees International Union, said protecting children from opiate-abusing parents is challenging. Adults can hide their drug use, he said, and social workers can only pull children from their home if they can prove that parents are being abusive or neglectful to such an extent that a child is in immediate danger.

It’s a difficult judgment that social workers and judges alike sometimes get wrong — with fatal consequences for children.

Lives cut short include Chase Gideika, a Lynn baby born with drugs in his system who was allowed to go home with his mother last year even though his older brother, a toddler, was placed in foster care after being found unattended near a busy street.

Three months later, Chase was allegedly fatally assaulted by his mother’s boyfriend, Anthony Gideika. His untimely death prompted the Patrick administration to call for a review of DCF’s decision to leave Chase and his twin with their mother and her boyfriend, both in drug treatment. The review by the Office of the Child Advocate is still pending.

In February of this year, 23-month-old Lucas Braman, also born with drugs in his system, was found unresponsive in his Yarmouth crib in the home of his mother’s cousin, who was caring for him.

Lucas had lived in a foster home, but was sent to live with relatives by a judge last year despite opposition from social workers, according to DCF spokesman Alex Loftus.

Prosecutors said there is no indication of foul play in the child’s death, but the toddler suffered from physical and emotional problems related to his neonatal drug exposure. Cape and Islands District Attorney Michael O’Keefe declined to speculate on how Braman died.

However, Elizabeth Cavallini, who was caring for Lucas when he passed away, believes his prenatal drug exposure contributed to his death. Lucas had many health problems, she said, such as banging his head against the wall so much he had to wear a protective helmet.

Cavallini, whose partner is a cousin of Lucas’s mother, said social workers should never have let Lucas go home with his mother in the first place and they should have provided more help caring for his fragile health.

“I’m extremely frustrated with the lack of concern with Lucas when he was born addicted to drugs,’’ Cavallini said. “It is not fair that these women can do drugs their entire pregnancy and walk out of the hospital with their babies. That is abuse in my eyes.”

A tragic end

Mya’s life came to an abrupt end on Sept. 23, 2011 when Marshfield police found the infant, cold and blue, lying on the living room floor, prosecutors said. According to court records and interviews, her grandmother Debra was giving her CPR when police arrived, while Mya’s father was screaming; Mya’s mother Ashley was calmly smoking a cigarette on the porch.

The 8-by-10 bedroom where Mya slept was filled with dirty dishes, soiled clothes and, on a shelf, hypodermic needles. In a bucket, prosecutors say, police found more used and unused needles, droppers, and heroin.

Later, toxicologists determined that Mya’s blood, liver, and kidneys tested positive for morphine. Prosecutors claim it came from a baby bottle in the home that tested positive for opiates. The next hearing is scheduled for May.

Jeffrey Pinkham does not believe his nephew meant to hurt his own daughter. He fears the parents just became blinded by addiction. He wonders what could have been done to save Mya. Her small body now lies in a plot specially saved for infants at the Pine Hill Cemetery in Quincy.

“They were two known heroin addicts,’’ he said about Mya’s mother and father. “When was the last time someone was there? They should have taken the kids out.”