MONDAY, Feb. 17, 2014 (HealthDay News) -- Having a stable home life as a child, nice friends and success at school reduces the odds of getting sexually transmitted diseases as a young adult, according to a new study.

The University of Washington researchers said the findings show that efforts to prevent STD infections should begin years before most young people start having sex.

"Kids don't engage in risky behaviors in a vacuum. There are environmental opportunities that have to be created," study lead author Marina Epstein said in a university news release. "Monitor your kid more generally, and make sure they're engaged in school and have friends who don't get into trouble."

The researchers analyzed data from nearly 2,000 Seattle-area participants in two youth-development studies that began in the mid-1980s and early 1990s. At age 24, the participants had been with an average of eight sexual partners. About one-fifth said they had been diagnosed with an STD such as herpes, Chlamydia, gonorrhea, syphilis or HIV/AIDS, according to the study, which was published online recently in the Journal of Adolescent Health.

About one-third of those who became sexually active before age 15 had an STD, compared with 16 percent of those who started having sex at a later age. Having more sexual partners and having sex after drinking alcohol or using drugs also were linked with a greater likelihood of having STDs.

The researchers also examined data collected when the participants were aged 10 to 14 and found that those who lived in homes with rules, discipline and rewards were less likely to have sex at an early age, as were those who liked school, their teachers and schoolwork.

Having childhood friends who were in gangs or who got into trouble with teachers or police increased the likelihood that kids would start having sex at an early age.

Millions of dollars are spent telling teens they should wait until they're married to have sex, but most teens have sex anyway, said Epstein, who is in the university's social development research group. "We would be better off spending that money preparing them to make healthy and responsible choices," she said.

"We already have good programs that have been shown to be effective at improving parent-child relationships and intervening with at-risk youth," Epstein said. "We should use our prevention dollars on programs that we know work and that show effects on a range of behaviors, including risky sex practices."