The first time many patients in the United States take prescription opioid painkillers is following surgery. But not everyone puts away the pills: In a new study, researchers found that 6 percent of patients continued to use the drugs for at least three months after surgery.

The researchers wanted to know more about why some people continue to use the drugs while others don't, so they looked at the types of surgery people had. But it turned out that it didn't matter whether someone had a major operation, such as bariatric surgery or a hysterectomy, or a minor procedure, such as varicose vein removal; there was no difference in how likely people were to continue to use opioids past the three-month mark.

However, the findings showed that the people who were more likely to continue to use the painkillers were those who smoked, drank alcohol, had certain mood disorders or had chronic pain.

The findings suggest that whether a person continues to take prescription painkillers long after his or her surgery "is not due to surgical pain but addressable patient-level" risk factors, the researchers wrote in the study.

More From LiveScience

In the study, a team of researchers led by Dr. Chad Brummett, an associate professor of pain management anesthesia at the University of Michigan Medical School, looked at data on more than 36,000 patients who received opioid painkillers after surgery in 2013 and 2014 but had not taken opioids at any point in their lives before that. The majority of the patients (80 percent) had minor surgeries, such as varicose vein removal or carpal tunnel surgery; the remaining 20 percent of the patients had major surgeries, such as bariatric surgery or surgery to remove the uterus.

The researchers found no statistically significant difference between the people who had major surgery and those who had minor operations in their likelihood to continue using opioids, according to the study.

Having ruled out the type of surgery as a predictor of who would continue to use opioid painkillers, the researchers looked to other factors.

People who smoked cigarettes, drank alcohol or had substance-abuse problems were more likely to continue taking opioids long after their surgeries, according to the study. For example, smokers were 35 percent more likely to continue taking opioids compared with people who didn't smoke. Those who had an alcohol or substance-abuse disorder were 34 percent more likely to continue taking opioids compared with people who didn't have one of those conditions.

In addition, people with anxiety were 25 percent more likely to continue taking opioids, the researchers found.

Finally, people who had chronic pain before their surgeries were 39 percent more likely to continue using the painkillers.

Though the study included only 36,000 patients, the researchers estimated that, based on the number of surgeries that occur in the United States each year, as many as 2 million people could start using opioids after a surgical procedure each year.

Because the study was observational, the researchers found only an association between prolonged use of opioids and certain risk factors. In other words, smoking or drinking, for example, don't necessarily cause a person to continue to use opioid painkillers; rather the study showed that people who already smoke or drink may be more likely to do so.

The study was published today (April 12) in the journal JAMA Surgery.

Originally published on Live Science.