Nine small regions of the genetic code may play a key role in determining whether someone is straight or gay, new research suggests.
Scientists uncovered the link after comparing the DNA of 47 pairs of male twins, including brothers with different sexual orientation.
By studying molecular data from the nine genome sites, the team was able to guess whether a twin pair was heterosexual or homosexual with 70% accuracy.
Lead researcher Dr Tuck Ngun, from the University of California at Los Angeles, said: "To our knowledge, this is the first example of a predictive model for sexual orientation based on molecular markers."
British experts were sceptical of the study, presented at the American Society of Human Genetics' annual meeting in Baltimore, and said more work was needed to confirm the findings.
The research is said to provide evidence of environmental influences affecting sexual orientation by altering the activity of certain genes.
These so-called "epigenetic" effects involve a molecular modification to DNA called methylation.
Dr Ngun's team developed powerful new computer software to look for patterns of the marker hidden within an individual's DNA that correlated with sexual orientation.
The analysis revealed nine small regions scattered across the genome where there was a close match between levels of methylation and the chances of being gay or straight.
"Sexual attraction is such a fundamental part of life, but it's not something we know a lot about at the genetic and molecular level," said Dr Ngun. "I hope that this research helps us understand ourselves better and why we are the way we are."
The study involved 37 pairs of twins in which one brother was homosexual and the other heterosexual, and 10 pairs in which both were homosexual.
An estimated 3% to 5% of the general population is homosexual, said the scientists.
Male sexual orientation has been linked to several regions of the genome, but there is strong evidence that environmental influences are important too. Identical twin pairs who share the same genes often differ in sexual orientation.
Hormonal effects in the womb may be one significant factor. Each male pregnancy a woman has increases the likelihood of her next son being homosexual by a third. And in women, early exposure to male hormones is associated with higher rates of lesbianism.
Commenting on the research, Professor Tim Spector, from King's College London, a leading expert on twin studies and genetics, said: "It has always been a mystery why identical twins who share all their genes can vary in homosexuality.
"Epigenetic differences are one obvious reason and this study provides evidence for this. However the small study needs replicating before any talk of prediction is realistic."
Darren Griffin, professor of genetics at the University of Kent, said: "To claim a 70% predictive value of something as complex as homosexuality is bold indeed. I wait with bated breath for a full peer-reviewed article.
"While there is strong evidence in general for a biological basis for homosexuality my personal impression has always been one of a multiple contributory factors, including life experiences."
Gil McVean, professor of statistical genetics at Oxford University, said: "Without validation of the result in an independent data set it is not really possible to know whether there is any substance in this claim."