A survey of high school students finds 77 percent of those who use heroin say they also have used opioid painkillers for non-medical purposes.

The survey of more than 67,000 high school seniors over a five-year period found 12.4 percent reported lifetime nonmedical opioid use and 1.2 percent reported lifetime heroin use. The more often teens used opioids for nonmedical purposes, the higher the odds they also used heroin, HealthDay reports.

“The more times a teen uses nonprescribed painkiller pills, the greater the risk he or she is at for becoming dependent on the drug,” said lead researcher Joseph Palamar of New York University. “People who become dependent on painkiller pills often wind up resorting to heroin use because it’s cheaper and more available than these pills.”

White students are more likely than black or Hispanic students to use opioid painkillers or heroin, the survey found. Black and Hispanic students were more likely to use heroin without first using painkillers recreationally. The finding suggests white students are more likely to transition from painkillers to heroin, the researchers report in the journal Drug and Alcohol Dependence.

Almost one-fourth of students who said they had taken opioid painkillers more than 40 times also reported using heroin.

“Any nonmedical use of opioids can be risky, but special attention needs to be given to adolescents who use more frequently,” Dr. Palamar noted in a news release. “Teens experimenting with pills need to look at all of these people around them becoming addicted to–and dying from heroin,” he said. “Most of these people started on pills and felt they had no choice but to move onto heroin. Targeting this group may prevent future heroin initiation, and decrease the troubling trend nation-wide in opiate-related deaths.”