Having just entered her 60s, Lynne C. Twaddle, a self-employed yoga teacher living on the Main Line, underwent surgery on her left hip, and then her right hip.

After those operations last year, her surgeon prescribed OxyContin for the pain. And that, her attorney said, was when her history of addiction caught up with her.

Twaddle, now 62, a recovering alcoholic, became addicted to the medication. She then moved to heroin. She was arrested last summer for selling the drug to a friend-turned-police informant and undercover police out of her home in the affluent Wayne section of Tredyffrin Township, not far from an elementary school.

"Tragically, it's a classic situation," said Gary Tennis, secretary of Pennsylvania's Department of Drug and Alcohol Programs. Four in five people who use heroin previously used prescription opioids, according to the National Institute on Drug Abuse.

Over the objections of prosecutors, who recommended up to five years in prison, Chester County Court Judge Phyllis R. Streitel accepted Twaddle into Recovery Court on Friday and sentenced her to 90 days in prison and seven years' probation, nearly a year of which she must spend on house arrest.

Law enforcement officials maintain that consequences should be harsh for drug distributors.

Last year, Pennsylvania reported a 23 percent increase in the number of overdose deaths compared with 2014, according to the Philadelphia office of the Drug Enforcement Administration. The 2015 state overdose death rate was 26 per 100,000 people, up from 21 per 100,000 people the year before. The national rate in 2014, the most recent year available, was 14.7 per 100,000 people. More than half of the people who died from drug-related overdoses had heroin in their systems.

In accepting her into Recovery Court, Streitel told Twaddle: "You were admitted, because you have a problem."

Twaddle, who underwent spinal fusion surgery this May and stood in front of the judge Friday wearing a back brace, said she was grateful to be admitted into the program.

Her age and Main Line zip code might surprise some, but experts say they shouldn't.

"This epidemic crosses all demographic lines: young, old; rich, poor; white, black; male, female. Across the board," said Michael Noone, first assistant district attorney for Chester County, adding that his office has seen addicts well into their 70s.

Twaddle is a college graduate who was born in Philadelphia, according to court documents.

A growing number of people ages 55 to 65 are becoming addicted to prescription medication, according to Beverly Haberle, executive director of the Council of Southeast Pennsylvania, an affiliate of the National Council on Alcoholism and Drug Dependence. She said some people use drugs to deal with major shifts in this stage of life, such as loss. Others are prescribed medications for various ailments as they age.

"We have a lot of physicians that have been trained to believe their job was to fix everybody's pain," Haberle said. "We have an expectation in our society now of better living through chemistry."

That has led to the overprescribing of pain medications, which leads to more heroin addiction, experts say. The state has collected more than 100 tons of prescription medication in the last three years as part of a U.S. Drug Enforcement Administration-backed drug "take back" effort, according to the state's Department of Drug and Alcohol Programs.

Pennsylvania is expected to receive at least $21 million from the federal government to prevent opioid abuse and treat addicts, Tennis said, as part of national legislation headed to President Obama's desk Tuesday.

Twaddle will receive credit for just over a month she has already served in prison against her 90-day sentence. After her release, she will enter an inpatient program, then a halfway house before she goes back home to serve house arrest.

Twaddle has lived in the house on the 400 block of Pugh Road with her husband for the last two decades, according to court documents. Her house is about 150 feet from the access road that leads to New Eagle Elementary School. Her home's attached garage and her backyard served as sites for heroin sales, police said.

Twaddle has an adult child who lives elsewhere. Her attorney, John I. McMahon Jr., said Friday she has "a lot of support" from her family.

Twaddle pleaded guilty in August to selling 22 baggies of heroin to a police informant and undercover police from her home and in the Phoenixville area. A police investigation did not find she sold to other people in the community.

She admitted that police found 67 baggies of heroin, or roughly 4 grams, in the master bedroom during a search of her house in July 2015. Prosecutors acknowledged some of the heroin was for personal use.

She was convicted for driving under the influence in 2004 and 2007, possession of a controlled substance in 2005, and possession of drug paraphernalia in 2011. She was a regular at Alcoholics Anonymous meetings for several years until she stopped attending and relapsed, her attorney said.

After her arrest, Twaddle completed drug-treatment programs at the Malvern Institute and Retreat at Lancaster County in the summer of 2015, and, later, at an outpatient clinic.

610-313-8207@MichaelleBond