(CNN) High school students in states that require universal background checks on all prospective gun buyers are less likely to carry guns compared to students in states that require background checks only on sales through federally licensed firearms dealers, according to a study published Monday in the medical journal Pediatrics.

On average, 5.8% of nearly 180,000 students who responded to the National Youth Risk Behavior Survey reported carrying a gun during the study period. The study did not account for adolescents who were not enrolled in school.

Researchers from Indiana University studied the survey data to determine if the National Instant Criminal Background Check System (NICS) had an effect on adolescent gun carrying, taking into consideration differences in state laws. The laws examined do not directly apply to adolescents.

About 17% of respondents who carried guns were from states with a universal background check (UBC) law at point-of-sale, whereas 83% were from states that did not have such laws.

"We've found that extending background checks is important to address the problem, but generally it involves more than just background check requirements," said Dr. Daniel Webster , director of the Johns Hopkins Center for Gun Policy and Research , who was not involved in the new research. "We find that licensing laws have a much bigger effect on legal access and use."

NICS in combination with universal background checks was found to reduce youth gun carrying by 25%, whereas NICS by itself did not. However, state laws requiring UBCs had no effect on adolescent gun carrying until after the NICS was implemented.

NICS, launched in 1998, is used to determine -- through national databases -- whether prospective buyers are eligible to purchase firearms. The study argues that one shortcoming of NICS is that it applies to licensed gun dealers but not to unlicensed private gun sellers, which generates a loophole in the law.

As a result, gun buyers denied by licensed sellers may purchase through private sellers, rendering NICS less effective in reducing sales to ineligible buyers, including adolescents.

Universal background checks are implemented by requiring licensed gun sellers, in addition to private sellers, to conduct background checks through NICS on all prospective buyers -- closing the private seller "loophole."

Impact of gun purchasing policies

Although restricted by age in purchasing guns, adolescents can still obtain guns through straw purchases -- someone purchasing on behalf of another person, or directly through unlicensed or illegal gun dealers. They may also have access to guns owned by family members or friends.

Youth access to guns increases the risk of firearm injuries to their peers and to themselves, and also increases public health care spending. About 86% of homicide victims ages 10 to 24 are killed by firearms, according to a 2016 report by the US Centers for Disease Control and Prevention.

The new study noted earlier findings that said 43% of youth suicides involve firearms and 44% of firearm injury costs are generated by people ages 15 to 24, suggesting that current policies to prevent gun sales to minors may be ineffective at reducing adolescent firearm access.

Most high school students who reported carrying a gun to school were older teens, male and white.

Regarding the racial differences, Webster said white students may carry guns for different reasons, including sports shooting and hunting.

"I worry a little bit about whether the part of the racial effects or differences that are reported here have something to do with a culture of sports shooting more for whites than for blacks or other non-whites," Webster said.

Of the students who reported carrying guns, 28% said they were threatened or injured by someone with a weapon such as a gun, knife or club on school property. However, experiences outside of school such as bullying, anxiety around mass shootings and other factors that could influence youth carrying were not accounted for.

"Their weapon-carrying practices have far more to do with what's going on outside of school than what's going on inside," so the survey data aren't an "ideal control for how risky the environment was for them," Webster said.

Factors behind adolescent gun carrying

It's possible that adolescents may be more likely to purchase from private sellers if they do not meet the minimum age requirements. Requiring all gun sales to be made through licensed dealers who either require a background check or a gun permit issued only after a background check could deter purchases by adolescents, the study said.

Get CNN Health's weekly newsletter Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

Adolescents also obtain firearms from their own homes, purchased legally by adults who may not always secure the weapons.

The study did not examine all possible reasons for students carrying guns, such as for school sports.

Webster said the study is "a signal and a reminder" for pediatricians to talk to parents of youth about how unsafe gun storage can be risky for their teen.