"Tickle is one of the broadest and deepest subjects in science."

So says Robert Provine, a neuroscientist at the University of Maryland, Baltimore. His career has included exploration of various "curious behaviours", including hiccupping, yawning and farting, so why does this one stand out?

In short, there is far more to tickling that you would think. "It concerns everything from body defence and the neurological program for play to the generation of the sense of self and other," says Provine.

As with so many other complex human behaviours, our animal cousins can help us understand what tickling is all about.

There are two types of tickling, and they both have great names: knismesis and gargalesis.

It's the only joke you can tell to both human babies and chimpanzees

Knismesis is a primitive response, a slightly irritating sensation triggered by a light movement across the skin, and it is widespread. "I would think that lizards, insects and virtually all beings have some sort of behaviour that has to do with defence of the body's surface," says Provine. Animals need to defend their bodies against biting insects and parasites, whether that means a quick scratch or a flicked ear, and knismesis describes such a response.

Gargalesis, on the other hand, is a singularly mammalian phenomenon. It is a harder tickle that results in laughter and is linked with play – a distinguishing feature of mammals.

At a basic level, tickle is a sensation involving nerve fibres associated with both touch and pain. But there is more to it than that. "Laughter-associated tickle might best be considered a social behaviour rather than a reflex," writes dermatologist Samuel T Selden in a 2004 review of the subject. Somewhere in evolutionary history, tickling became funny.

"Tickle is the primal stimulus for laughter," says Provine. "In fact, 'feign tickle' is my candidate for the world's most ancient joke. The 'I'm gonna get you…', threatening-to-tickle behaviour. It's the only joke you can tell to both human babies and chimpanzees."

This is something that Marina Davila-Ross, a psychologist at the University of Portsmouth, UK, can attest to. She has dealt with her share of giggling chimpanzees.

By enlisting zookeepers and mothers to tickle their ape and human baby charges, respectively, she has explored the links between laughter in human and non-human apes.

For an ape to find something funny, they need to be actively playing

"We used the acoustic data [of laughter] similarly to how a geneticist uses genetic data in order to reconstruct evolutionary relationships," she says.

This work, published in 2009, appeared to confirm that human laughter developed from vocalisations found in the common ancestors we share with apes.

While the gorillas and bonobos in Davila-Ross's research produced more human-like sounds, the more distantly-related apes made noises that, out of context, would not be recognisable as laughter. However, by constructing a family tree of these sounds, she demonstrated the progression from brief grunts into the chuckles and guffaws made by humans.

This research traces the evolutionary history not only of laughter, but of tickling too. "An ape would not watch other apes playing or doing something funny, and laugh," says Davila-Ross. "They do not produce vocalisations free from behavioural context."

For an ape to find something funny, they need to be actively playing with their fellows. Tickling is part of the rough-and-tumble play carried out by all young apes, including humans. That kind of play can leave you breathless, and this breathlessness is what resulted in laughter as we know it.

"The 'ha-ha' of laughter is what I call the ritualisation of the sound of laboured breathing from rough-and-tumble play. If you tickle a chimpanzee, its laughter is a panting sound," says Provine, making panting noises down the phone to emphasise his point. "This is a way for the chimpanzee to indicate 'this is play, I'm not attacking you'. It's one of the clearest cases of where a vocalisation comes from."

For social animals like primates, tickling is a great way of reinforcing friendships in a controlled way. While human laughter is far more elaborate, this is where Provine thinks it originated.

Humans split from the great apes between 10 and 16 million years ago. The presence of this same tickle-laughter dynamic across the family suggests that it has existed for at least that long – or perhaps even longer. Although laughter and tickling are not exactly top of most research agendas, limited studies appear to show some similarities with more distantly related mammals.

Elephants do seem to tickle each other and be tickled

One day, ethologist Patricia Simonet was watching her dog Goodall (named for the primatologist Jane Goodall) spinning an office chair around and making noises that indicated it found the activity hilarious. She wondered if "laughing" would be an accurate description of this behaviour. Then, while at a conference the real Jane Goodall suggested that Simonet ought to test this phenomenon. So that is exactly what she did.

As with the chimpanzees, Simonet found that a laughter-like "breathy pronounced forced exhalation" was associated with play. Recordings of it could even be used to decrease stress in other dogs.

A few years prior to this, Simonet had reported Asian elephants in captivity emitting "quiet breathy sounds" during play. Though she had not described these sounds as laughter at the time, she nevertheless made the connection when considering her newly discovered "dog-laughs".

"Elephants do seem to tickle each other and be tickled," says Provine, citing testimony from Kenyan elephant expert Joyce Poole.

That said, it is not easy to test whether the tickling and laughter demonstrated by these creatures is analogous with our own. "It would take a brave researcher to dive into the pile of cavorting pachyderms and stimulate them," says Provine. "It would probably be downright dangerous."

To study a complex behaviour like tickling, it helps to work on a slightly smaller scale.

Rats are the go-to mammal for researching pretty much anything, and tickling is no exception. Tickling rats in the name of science has been going on for two decades, starting with a controversial 2010 paper by psychobiologist Jaak Panksepp and his then-undergraduate student Jeffrey Burgdorf.

Having already identified high-frequency noises emitted by playing rats, inaudible to the human ear, Panksepp was struck by the idea that they could be distantly related to the noises made by playing humans. With this in mind, he approached Burgdorf with an offer he could not refuse: "come tickle some rats with me."

At the time, the world was not ready for laughing rats, and there was considerable resistance from the scientific community. Since then, however, numerous studies have been undertaken using "heterospecific hand play" (tickling) to study positive emotions in these rodents.

It would suggest that joyful affect emerged much earlier within mammalian brain evolution than is generally believed

"The identification of specific calls only emitted during tickling and other positive situations (e.g. play, sex), and the similarity of the tickling procedure to human tickling, led to a considerable amount of research," says Luca Melotti of the University of Bern, Switzerland, who has been researching the effects on facial expressions in rats following a good tickle. "That [research] demonstrated that tickling activates the same brain areas and neuronal pathways that are involved in the experience of positive affect (joy, happiness) in humans."

When Davila-Ross conducted her research, she noted that young apes were the ones who enjoyed tickling most. "It's easy to tickle a juvenile ape," she says, laughing. "They just don't want to stop. It's very difficult to get rid of them."

The same is true with rats. Melotti and many other researchers have noted that it is the young rats who enjoy the procedure most, and will often chase the experimenters' hand around in the hope of more tickles. It is hard not to compare this kind of behaviour with that of a playful toddler.

"If more primitive mammals also exhibit such emotional responses," write Panksepp and Burgdorf, "it would suggest that joyful affect emerged much earlier within mammalian brain evolution than is generally believed."

If tickling – and laughter – were present in the common ancestors of humans and rodents, that would place their origins at more like 80 million years ago. But Davila-Ross still thinks we should be careful when talking about laughing rats, dogs, or any other non-human animals.

"I would be careful with statements like that," says Davila-Ross. "There would have to be a phylogenetic analysis in order to make those claims." Instead she prefers the term "positive vocalisations", of which laughter is just one, even in humans.

The lorises are not taking pleasure from being tickled

"My guess is that, just as in chimpanzees, laughter is the laboured breathing of rough and tumble play," says Provine. "That may also be true of rodents, but I don't believe anyone has examined that yet." It is hard to study the ultrasonic vocalisations of rats, let alone create the kind of family trees that Davila-Ross was able to build for apes. "The further we get from humans, the harder it is to equate all the properties of it," he adds.

Though scientists are wary when applying human characteristics to animals, the general public is not. Cute animal videos are the internet's major currency, and that includes animals being tickled. "There are plenty of anecdotal accounts on YouTube of tickling given to owls, penguins, meerkats and even fish," says Melotti. "While it is more than possible that some of these accounts correspond to tickling and happiness arising from it, as a scientist I would recommend being cautious with these interpretations."

A cautionary tale comes from International Animal Rescue's Tickling is Torture campaign. Viral videos of slow lorises – adorable primates found in South East Asia – being tickled have chalked up millions of views online. But not only do these videos encourage the illegal trade in these endangered animals, the lorises are not taking pleasure from being tickled: their cute-looking response is actually fear.

"When it comes to videos depicting animals apparently willingly and happily doing unusual or unnatural things, all is often not what it seems," says Phily Kennington, who led the campaign. "We should all exercise our critical judgement to question the integrity of what we are seeing before getting carried away by the cuteness."

The fact is, it is hard to accurately assess animal feelings.

Even our beloved cats and dogs might not enjoy tickling as much as we think they do. After all, tickling in humans is not exactly a straightforward behaviour. Depending on who you ask, tickling can be pleasant or painful; it can be erotic, or used as a form of torture.

Understanding animal happiness can also improve animal lives, especially their conditions in captivity

When studying humans, scientists like Provine can at least ask their subjects extensive questions about how tickling makes them feel, how they like to be tickled and so forth, but with animals, things are not so simple. Increasingly, however, researchers are focusing more on the pursuit of animal happiness.

"In the last decade, there has been a trend towards studying the positive side of emotions in animals," says Melotti. Historically, studies in this area have been limited, and those that have taken place focused on a handful of study species: mostly rats, as well as dogs and great apes.

Learning about behaviours like tickling and laughter can seem a little esoteric, but it has practical applications. Since his time tickling rats with his PhD advisor, Burgdorf has used what he learnt to help develop treatments for psychiatric disorders. Understanding animal happiness can also improve animal lives, especially their conditions in captivity.

But beyond that, the key lesson from research into tickling is that animals are complex beings, capable of positive emotions comparable with our own. Understanding this can tell us about our relationship with them, and what it means to be human.

Follow Josh Gabbatiss on Twitter @Josh_Gabbatiss