As an enduring mystery of the human condition, it has been praised and damned in equal measure. It is a bridge over the abyss of isolation but can be a bit like croquet: easy enough to grasp the rules but a hard game to enjoy.

Now scientists in Britain have taken the puzzle of monogamy and boiled it down to one big question: how did it come about in the first place? A new study claims finally to have an answer.

"Humans have ended up monogamous to some extent, it's the predominant way we live," said Christopher Opie, an anthropologist at University College London. "What we have now is an evolutionary pathway for the emergence of monogamy."

How males and females come together is as varied as anything in nature. Around 90% of birds live in pairs, but less than 3% of mammals do. Humans and other primates fall somewhere in the middle, with a quarter of species pairing up, according to Opie.

What leads some species to monogamy and others not has prompted scientists to come up with three possible explanations.

One is that when offspring are demanding, two parents might be better than one. The second, known as "mate guarding", proposes that males need to stay close to their mates to ward off rival males. The third is that males stick with females to defend their offspring against the violence of other males, who want to kill existing offspring so that females become fertile again and can be impregnated.

Opie's team drew up a plan to find out which hypothesis most likely led to monogamy. They took a family tree of 230 animals, including lemurs, bushbabies, monkeys, apes and modern humans, and collected information on their mating behaviour, rates of infanticide and paternal care.

Next, they used simulated evolution from 75m years ago to modern day. As the simulation ran, it showed how monogamy rose and fell for different species. Having run the program millions of times, they found that the evolution of monogamy in primates was preceded by one thing only: infanticide by males.

"You do not get monogamy unless you already have infanticide, and you do not get a switch to paternal care if you don't already have monogamy," said Opie, in research published in the journal Proceedings of the National Academy of Sciences.

Opie says the findings are linked to increases in brain size. In primates, brain size expanded as social groups grew larger, which meant that mothers were infertile for longer and more males were close by. For males, infanticide was a strategy to make females fertile again.

"Monogamy is only one strategy for dealing with infanticide. But it's not the only one," said Opie. "Chimps mate with all the males in their group to confuse paternity so males won't attack. But in others, humans included, males stick with females to protect them." Once a species becomes monogamous, paternal care and other behaviours evolve that help offspring to thrive, he said.

Robin Dunbar, a co-author on the paper and director of the social and evolutionary neuroscience at Oxford University, said : "It highlights the risk of infanticide and harassment for primates in general and it simply gets worse and worse as you get bigger brains, because the reproductive cycle gets longer." Dunbar believes monogamy evolved in our human ancestors only after modern forms emerged 200,000 years ago, and perhaps in the past 100,000 years.

For some scientists, however, the mystery of monogamy remains unsolved. Dr Maren Huck, who studies animal behaviour at the University of Derby, said the findings should be treated with "extreme caution". She said the authors had labelled some animals as monogamous that were not in the wild, and made false assumptions about the impact of infanticide. "Owl monkeys give birth once a year. So if the female loses her offspring, she will not resume oestrus again until the next breeding season the following year. Hence, killing the offspring would not hasten reproduction," she said.

She also queried the classification of monogamy, saying the numbers seemed very high. "Very few old world monkeys, for example, are monogamous."