Women who fail to orgasm during sex may be genetically programmed to weed out unreliable men who are a flop between the sheets, according to new research.

Scientists who have studied the ability of thousands of women to climax say it is largely written in their genes - the most compelling evidence so far that the female orgasm has a biological role.

The findings suggest the failure of some women to orgasm regularly is not a dysfunction, but a sophisticated mate-selection strategy that evolved during prehistoric times.

Tim Spector of St Thomas's hospital in London, who led the research, said: "The theory is that the orgasm is an evolutionary way of seeing if men can prove themselves to be likely good providers or dependable, patient and caring enough to look after the kids."

Women who orgasm very easily may be more likely to be satisfied with poor quality men.

"Perhaps women who had orgasms too easily weren't very good selectors," Professor Spector said. "It paid women to be more fussy and this is one way of doing it. The simple fact is that it takes women on average 12 minutes and men two and a half minutes to reach orgasm. Adjusting to that imbalance is a test."

His team used a national register of twins to ask 4,037 women, aged 19 to 83, about their sex lives and to compare their DNA. About half were identical twins, who share all their genes. The others were non-identical twins, who do not. Assuming twins are brought up in similar environments allows scientists to tease out the differences that are down to genes.

Thirty-two per cent of the women said they never or infrequently experienced an orgasm during sex, and 21% during masturbation. Only 14% said they always had an orgasm during sex.

Genetic comparisons showed that 34% of the variation during intercourse was inherited. In the case of masturbation, 45% of the difference was down to genes. The findings appear today in the Royal Society journal Biology Letters.

Prof Spector said these were low estimates because they were based on answers to intimate questions. In reality, genes are probably the greatest single factor involved in whether women have an orgasm or not.

The genes could work on a physical level, perhaps causing variations in the G-spot, the angle of the vagina, or the clitoris. They could work psychologically, to alter a woman's confidence or mood, or they might vary the activity of enzymes or hormones.

"It's likely to come from the mother's side but we can't say that it doesn't come from the father, if, for example, it's a psychological state rather than purely anatomical," he said.

The research opens the door to further studies to identify the relevant genes and perhaps develop treatments to help more women reach orgasm. "If the motivation and funding were there you could find a number of the genes involved within a few years. Each of those would show you a new mechanism that, in theory, you could make drugs to interact with. But there's so little research, it's really a taboo area."

The genetic control over how easily women experience an orgasm during sex shows it is subject to evolutionary pressure, which means it must confer a biological advantage.

One theory is that orgasms promote fertility. Studies have shown that women are slightly more likely to have an orgasm when they are ovulating. There is also evidence that the uptake of sperm is increased when a woman climaxes. But if this were the only explanation, all women would have orgasms.

"The theory I prefer is the mate selection theory," Prof Spector said. "If a man is considered powerful enough, strong enough, or thoughtful enough in bed or in the cave, then he's likely to hang around as a long-term partner and be a better bet for bringing up children."