Romance may have existed in some form long before the origin of humanity, and some believe it was born out of death and violence

Your heart beats a little faster, glands open to secret tiny dribbles of sweat, and your body starts producing hormones, which make you feel a bit giddy and warm inside.

Love is not time's fool

These are some of the biological processes that occur as you are thrust into the early throes of love – or infatuation, it can be hard to tell which it is.

Love is such a pervasive part of our humanity that art and culture is filled with references to love won and love lost. Libraries have shelves of books filled with romantic prose. "Love is not time's fool," wrote Shakespeare in sonnet 116: "Love alters not with his brief hours and weeks / But bears it out even to the edge of doom."

It seems Shakespeare was more correct than he could have known. Peer into the evolution of love in the animal kingdom and it becomes apparent that love had its beginnings long before the advent of humanity. What's more, it could have been born out of something quite sinister.

The journey to love as we know it today began with sex, which was one of the first things life on Earth figured out how to do. Sex began as a way to pass on an organism's genes to the next generation.

To love, life first needed a brain that could deal with emotions. It was not until a few billion years after life began that the brain began its journey to existence. At first it was only a small clump of cells.

Love alters not with his brief hours and weeks

Fast forward to around 60 million years ago, when the first members of our family, the primates, appeared. Over millions more years of evolution, some primates would evolve ever bigger brains, eventually producing modern humans.

But there was a problem. As our brains grew, our babies had to be born earlier in development. Otherwise their heads would be too big to pass through the birth canal.

As a result, baby gorillas, chimps and humans are almost entirely helpless. Their parents therefore had to spend ever more time caring for them.

This prolonged childhood created a new risk.

In many primates today, a mother with a dependent infant is unavailable to mate until her infant is weaned. To get access to her, a male would first have to kill her child. This sort of targeted infanticide goes on in many species, including gorillas, monkeys and dolphins.

This led Kit Opie of University College London in the UK and his colleagues, to propose a startling idea. Almost a third of primates form monogamous male-female relationships, and in 2013 Opie suggested that this behaviour had evolved to prevent infanticide.

Infanticide has been the driving force for monogamy for 20 million years

His team peered back into the family tree of primates to reconstruct how behaviours like mating and parenting changed over the course of evolution. Their analysis suggested that infanticide has been the driving force for monogamy for 20 million years, because it consistently preceded monogamy in evolution.

Read more: Why pairing up for life is hardly ever a good idea

Other species found different solutions, which is why not all primates are monogamous. For instance, chimps and bonobos minimise the risk of infanticide by being highly promiscuous. The males do not kill babies because they do not know which are theirs.

But in those species where males and females started bonding strongly, their offspring's chances of survival improved because the males could help out with parenting. As a result, monogamy was favoured by evolution, says Opie.

Love depends on regions of the brain that only appeared quite recently in our evolutionary history

This process may have been a one-way street, says Robin Dunbar of the University of Oxford in the UK. It could have resulted in major changes in the brain, "to keep the pair-bond together for life". This includes a preference for your partner and antagonism towards potential rivals.

This in turn could have been the "kick" that changed human evolution, says Opie. Extra male care helped early human societies grow and thrive, which in turn "allowed our brains to grow larger than our closest relatives".

There is evidence to back this up. As brain size started to expand, so did cooperation and group size. We can see a trend towards larger groups and more cooperation in the early-human species Homo erectus, which lived almost two million years ago.

What's more, it seems that aspects of love depend on regions of the brain that only appeared quite recently in our evolutionary history.

Stephanie Cacioppo of the University of Chicago in Illinois, US, scoured the scientific literature to find fMRI brain imaging studies that examined the parts of the brain involved in love. She found that the most intense and "abstract" states of love rely on a part of the brain called the angular gyrus.

We do not know what chimpanzees feel about their mates

This is known to be important for certain aspects of language, like metaphors. This makes some sense, as without complex language we cannot express the more refined and intense aspects of our emotions. Conceivably, Shakespeare's angular gyrus was active when he penned his love sonnets.

The angular gyrus is only found in great apes and humans.

We do not actually know what role it plays in apes' emotions, says Cacioppo, because "complementary fMRI experiments have not been performed on apes". So we do not know what chimpanzees feel about their mates. Obviously they do not write sonnets, but neither do most humans.

Still, Cacioppo's findings offer some support to the idea that our growing brains helped love to flourish.

However, Opie's idea that infanticide kick-started this process is controversial. Not everyone agrees it played any role in the development of monogamy.

Female competition could have encouraged pair bonds

Anthropologist Robert Sussman of Washington University in St Louis in Missouri, US is one of the sceptics. He says that both monogamy and infanticide are such unusual behaviours that they are unlikely to be linked.

There are alternatives. A 2014 study suggested monogamy evolved as an outgrowth of a "mate guarding strategy": that is, males staying with a female to ensure that no one else mates with her.

One year later, another study reconstructed the evolution of another group of primates called lemurs. It found that female competition could have encouraged pair bonds.

Opie disagrees. He says the methods in these studies "cannot be used to determine the switch to monogamy".

What is certainly true is that many primates get by just fine without pair-bonded parents, and presumably without anything akin to romantic love. But there is one thing all primates do have in common: a strong mother-child bond.

This is true, "even in the nocturnal primates that live solitarily," says Sussman. He suggests that the brain processes underlying the mother-child bond were "hijacked" to create romantic love.

There is evidence from neuroscience to suggest he is right.

Love is hard to define, but neuroscientists agree that there are several overlapping stages.

The first stage is sexual desire: we feel attracted to another person. Touching them releases feel-good chemicals and we experience an intense longing to be with them.

Intense pleasure from the sexual desire stage can lead directly to love

Parts of our limbic system, one of the more ancient bits of the human brain, are active during this stage. This includes the insula, an area known to be involved in intense emotional experiences. The ventral striatum is also in overdrive. It is the hub of the brain's reward system, and when we see an attractive face it lights up: we are rewarded simply by looking at the person we desire.

As desire moves onto the next stage – romantic love – the limbic system again plays a key role. It pumps out the feel-good chemical dopamine and the hormone oxytocin, which binds people together.

This progression implies that intense pleasure from the sexual desire stage can lead directly to love, says Cacioppo. "Love tends to grow out of desire. You cannot passionately love someone you never desire."

At the same time, other more advanced areas of the brain are suppressed.  For instance, research has shown that parts of the prefrontal cortex are deactivated. This is an area involved in rational decisions.

Evolution wants two individuals to spend a lot of time together to get a pregnancy going

In this stage, we are literally "crazy in love". People in love do not process the world around them, says Thomas Lewis, a neuroscientist at the University of California, San Francisco in the US. "They're not evaluating the person critically or in a highly cognitive way."

Serotonin, which usually helps us feel calm, is also suppressed. This makes some sense when you consider how obsessed we can become when in love. Serotonin levels are also low in the brains of individuals with psychological disorders like obsessive compulsive disorder.

"What evolution wants from the falling in love state is for the two individuals to spend a lot of time together… in order to get a pregnancy going," says Lewis.

But once the deed is done, couples do not stay bound together in such an intense, obsessive state for long. After several more months, sometimes after an intermediate "honeymoon period", the companionship stage begins.

Now the serotonin and dopamine levels normalise. But there is still a feeling of closeness, helped along by more oxytocin. If you suppress oxytocin in a monogamous species, such as a prairie vole, the animals stop being monogamous.

"The bonds that hold people together are not dopamine-driven or by intense delirious excitement," says Lewis. "There is reward there but it's more sedate."

This brings us back to Sussman's suggestion that romantic love evolved out of mother-child bonding. The bonds of long-term couples are similar to those between mother and child, and rely on similar hormonal processes.

In both animals and humans, research has shown that separation from a "loved one" creates similar feelings of emotional pain. It makes sense that we want to avoid the pain of separation by staying together.

These feelings seem to have deep roots in evolutionary history.

The limbic system plays a key role in all the known stages of love. Many other mammals, and even reptiles, have some form of limbic system. This area of the brain was around long before the first primates.

Animals' brains have been primed for at least some forms of love for hundreds of millions of years

"The oldest parts of the brain are involved in attachment, in pair-bonding, and these areas are activated in many species," says Cacioppo.

In other words, animals' brains have been primed for at least some forms of love for hundreds of millions of years. Along the way, other factors pushed our ancestors to evolve ever bigger brains, allowing romantic love to get its claws into us.

Whether it was infanticide or a mother's attachment to her infant that pushed us to get close, we can be thankful that something did. We owe much of our success as a species to that crazy little thing called love.

Melissa Hogenboom is @melissasuzanneh on Twitter. Follow BBC Earth on Facebook, Twitter, and Instagram

If you liked this story, sign up for the weekly bbc.com features newsletter.