Her back ached from a compression fracture; a shattered elbow was still mending; her left-hip sciatica was screaming louder than usual. She takes a lot of medication for chronic pain, but today it was just not enough.

Yet rather than increasing her dose, Dr. Wergin was tapering her down. “Susan, we’ve got to get you to five pills a day,” he said gently.

She winced.

Such conversations are becoming routine in doctors’ offices across the country. A growing number of states are enacting measures to limit prescription opioids, highly addictive medicines that alleviate severe pain but have contributed to a surging epidemic of overdoses and deaths. This week the federal government issued the first national guidelines intended to reduce use of the drugs.

In Nebraska, Medicaid patients like Ms. Kubicka-Welander, 56, may face limits this year that have been recommended by a state drug review board. “We don’t know what the final numbers will be,” Dr. Wergin told her, “but we have to get you ready.”

As politicians and policy makers decry the opioid crisis, the country’s success in confronting it may well depend on the ability of physicians like Dr. Wergin to reconcile their new role as enforcer with their mission of caring for patients. Collectively, primary care physicians write the greatest volume of opioid prescriptions — according to a recent study, 15.3 million prescriptions for Medicare patients alone in 2013. The burden of monitoring patients for potential abuse, while still treating pain that is chronic and real, falls largely on these front-line gatekeepers.

“I have a patient with inoperable spinal stenosis who needs to be able to keep chopping wood to heat his home,” said Dr. Wergin, 61, the only physician in this rural town. “A one-size-fits-all prescription algorithm just doesn’t fit him. But I have to comply.”

In prescribing opioids, Dr. Wergin, who is also chairman of the board of the American Academy of Family Physicians, is taking professional and personal risks. He must go through an elaborate prescription checklist, with state and federal officials looking over his shoulder. He has faced threats from addicts who show up at the hospital emergency room, desperate for pills. Following the recommendation of his malpractice insurance carrier, he now requires his patients to sign “pain management contracts,” in which they must agree to random drug tests before receiving an opioid prescription.

Main Street in Milford, Neb., a rural town with a population of 2,090. A cattle feed company is just outside town, and the nearest city, Lincoln, is 30 miles away.Credit
Michael Kirby Smith for The New York Times

Though he has been enmeshed in his patients’ lives for decades, having gone to grade school with many of them and delivered their children and grandchildren, the new vigilance has injected an uncomfortable layer of suspicion in his relationships with them.

“I don’t want to stop prescribing opioids altogether,” Dr. Wergin said. “But I can see why some doctors have gotten to that point.”

Pain is one of the chief reasons people go to their doctor. Once overlooked and even dismissed, pain has been a standard vital sign on a patient work-up for nearly two decades. But unlike blood pressure, it is difficult to measure, not least because people’s ability to tolerate pain is highly individual.

Often an orthopedic surgeon or emergency room physician will write an initial opioid prescription for “short-term use,” said Dr. Jonathan H. Chen, an instructor at the Stanford University School of Medicine who researched the Medicare data, but “the prescribing doctor never sees the patient again and never realizes the problem they triggered.”

The patient follows up with a primary care doctor, who now has to manage the patient’s opioid use.

Dr. Wergin’s patients often lack the means to consult pain specialists in Lincoln, the closest city, 30 miles away. So he is their doctor of first and last resort. Wherever you turn in Milford (population 2,090), there he is: the doctor for a local nursing home, for the town’s volunteer fire department, for the high school sports teams, sometimes making house calls in his weather-beaten Chevy Tahoe. When his patients are hospitalized, it is to him they complain about the overcooked salmon, expecting he can take care of that, too.

A patient visits Dr. Wergin to renew his prescription pain medications at a time when doctors are anticipating guidelines that will limit prescription opioids.Credit
Michael Kirby Smith for The New York Times

Buoyant and chatty, Dr. Wergin seems to have stepped out of a Norman Rockwell painting, with his faux-threats to give rambunctious young patients a “mind-your-mother shot,” and his prescriptions for relieving his own stress: baking pies or road-testing his 1962 red Corvette. And so he is particularly uneasy about the skepticism he must now bring to patient care.

Patients look at him, stricken and indignant, when asked to sign a pain contract. “Do you think I’m an addict?” they say. Or, “I don’t need a contract for my heart medicine, so why this?”

Why? When a random drug test of one longtime patient showed no trace of prescribed opioids, Dr. Wergin had to “fire” him for breaking the contract. Instead of taking the pills, the patient had been selling them.

Dr. Wergin has learned to be even more wary during his emergency room shifts at the hospital 15 miles away. There, he has seen firsthand a growing number of overdoses and opioid-related deaths.

The scenario has become so familiar that now when a nurse reports that the patient in Room 3 is complaining of excruciating back pain and asking specifically for Percocet, Dr. Wergin will reply, “And is he about 31, single or divorced, and insisting he is allergic to nonsteroidals?”

These are “seekers ’n’ sellers,” he explained, who peel off I-80 and head for the hospital “thinking we’re just ignorant hayseeds.” A few months ago, state troopers pulled guns on one such man, who had stormed into the hospital demanding pain medications and threatening Dr. Wergin and other staff members.

As Dr. Wergin recounted this, driving through the fog-shrouded back roads of winter-stubble prairie, where patients are rushed to the emergency room after being crushed by forklifts and tractor tipovers, he recoiled against his own cynicism.

An error has occurred. Please try again later.

You are already subscribed to this email.

Still, he has made adjustments. He now rarely writes prescriptions for oxycodone, which is prized on the street. For other painkillers, he logs into an electronic pharmacy registry to view the patient’s other medications. Although every state but Missouri has such a system, Nebraska’s, like many, is not foolproof: patients can opt out for privacy reasons and not all insurers, who supply the data, opt in.

And most state electronic systems are not compatible with one another. “A Nebraska patient can just drive 80 miles to a Kansas E.R. and get another prescription and no one would know,” Dr. Wergin said.

Prosecutors and medical review boards are increasingly scrutinizing physicians who prescribe controlled substances. A colleague of Dr. Wergin’s in a nearby community was investigated for two years after a patient died of an overdose. Although she was cleared, the reputation of her small-town practice was damaged. She moved to another state.

Larry TeSelle, 76, helps his wife, Beverly Jean TeSelle, 71, move into her wheelchair at their home in Milford.Credit
Michael Kirby Smith for The New York Times

The management of chronic pain has had a long, fractious history in the United States. In the 1990s, doctors were admonished for undertreating pain. Opioids, they were told, including newer ones like OxyContin, could be safely prescribed and bring life-changing relief. Now the pendulum has swung sharply back and doctors have been scrambling for alternatives.

Some state medical boards recommend limiting the number of opioid doses per month. Others limit by strength of daily dose. The new guidelines by the federal Centers for Disease Control and Prevention advise primary care doctors to treat pain first with measures such as aspirin and ibuprofen. Three days of opioids will usually suffice, they said, and rarely more than seven.

Although much contention surrounded the drafting of the guidelines, everyone generally agrees that patients should not be custodians of large quantities of opioids. One of Dr. Wergin’s patients, Gene Filbert, 64, had been taking 240 short-acting hydrocodones a month, or about eight a day, to keep at bay the pounding pain that has resisted five surgeries for the elbow and wrist he smashed in a fall while installing a telephone line. An alternative, fentanyl, a slow-release, higher-dose patch, nauseates him. Dr. Wergin has now inched him down to 180 pills a month — but the coming Nebraska limit may be 150.

In a small town, lots of folks know about Mr. Filbert’s pain — and his pills.

“People ask me all the time if they can have a few,” said Mr. Filbert, a man with a raspy voice and a silver-streaked beard. “And I say, ‘Hell no, the doctor’s shorting me already!’ ”

Many medical associations now offer doctors training about opioids and chronic pain, urging them first to use other remedies: physical therapy, acupuncture, anti-inflammatories, antidepressants, counseling.

But alternatives are unrealistic for some. Physical therapy is too expensive for Ms. Kubicka-Welander: she can scarcely make the rent on her home in a trailer court. Patients with a compromised liver cannot take high doses of acetaminophen. Those on blood-thinners should not use ibuprofen.

Dr. Wergin is careful not to assure patients that they will be “pain-free.” Instead, he talks about setting realistic goals while living with pain. Can they work? Walk? Sleep?

The problems faced by Beverly TeSelle, 71, defy most solutions.

After a second stroke that left her using a wheelchair, Mrs. TeSelle, formerly a gregarious accountant, began to suffer vicious headaches that left her weeping and moaning.

“The biggest relief for both of us is when she goes to sleep,” her husband of 53 years, Larry, said, tearfully.

Dr. Wergin noted that Mrs. TeSelle, whose strokes have also left her with slurred speech, and hand, arm and shoulder pain, already takes more than what may be allowed by coming state limits. He considered increasing the dose of her fentanyl patches but said, “I worry about respiratory depression.”

He reviewed the list of her medications.

“Let’s at least try to reduce those headaches so she can talk with her friends and family,” he said, recalibrating doses.

Slide Show|6 Photos

Small Town Doctor, Big Responsibilities

Small Town Doctor, Big Responsibilities

CreditMichael Kirby Smith for The New York Times

Dr. Wergin’s final patient of the day, a 55-year-old woman, had three rotated vertebrae in her lower back, migraines and a mastectomy for breast cancer this fall. She asked not to identified because she worried her opioid use might jeopardize her job.

Her fibromyalgia was flaring up, she told Dr. Wergin. Pain was aggravating her insomnia.

Dr. Wergin nodded. “It will be very difficult to get an override for your dose.” Instead, he increased her antidepressant.

“It’s people like my husband who screwed the rest of us over,” she said.

Her husband, she explained, used to sell methamphetamine and OxyContin. His doctor in Lincoln would readily write prescriptions. One night six years ago, she found her husband on the floor of their bedroom, dead, mostly likely from an overdose.

“It’s rough cutting back when I’m at a level that almost works,” she said to Dr. Wergin.

A rare flicker of frustration crossed his face.

“I’m sorry,” Dr. Wergin said.

A version of this article appears in print on March 17, 2016, on Page A1 of the New York edition with the headline: His Patients in Pain, a Doctor Must Limit Their Use of Opioids. Order Reprints|Today's Paper|Subscribe