Earlier this year I visited the temple of the goddess Hathor at Dendera on the west bank of the Nile in Egypt. Dating from perhaps the first century BC, the temple is decorated with a relief depicting Cleopatra, paramour of Julius Caesar and Mark Antony, and Egypt’s final pharaoh. Few images of Cleopatra survive – a haggish profile stamped on a bronze coin suggests that she looked nothing like Elizabeth Taylor in Joseph L Mankiewicz’s epic film of 1963 – so the relief at Dendera is tantalising and important.

Yet my eye was drawn to another figure altogether who was considerably more ugly than pointy-chinned Cleopatra. This frightening character appears in several places around the site, but he is especially prominent in a relief carved onto a fragmentary limestone pillar that once supported a smaller building known as the ‘birth house’ near the temple.

With the squat, stocky body of a bandy-legged dwarf, he faces outwards, arms akimbo. His grotesque head has a leering, lewd expression, as his thick tongue lolls towards his chin, while the strands of his beard end in flickering spirals. A tail dangles suggestively between his legs. This, I learned, was the ancient Egyptian deity Bes – who was beloved for centuries not only in Egypt but also across the Mediterranean, and ultimately helped to shape the appearance of the Christian Devil.

Although he never had a state-sanctioned cult, Bes was tremendously popular in ancient Egypt. He was worshipped in ordinary homes, where he was associated with many of the good things in life: sex, drinking, music, and merriment. He also had an important protective function, and was often invoked during childbirth (hence his appearance in the divine birth house at Dendera). In other words, although to modern eyes he may appear frightening, he was actually decent. Friend to beer-swilling carousers and expectant mothers alike, he warded off noxious spirits like a gargoyle on a medieval church.

Wine, women and song

According to the Iranian archaeologist Kamyar Abdi, “The Bes-image was used in ancient Egypt to decorate a large number of personal belongings and furniture. [He] was carved on beds or headrests, mirrors and spoon handles, amulets, and cosmetic containers.” As a result, museums around the world contain thousands of artefacts (including ‘magical’ wands and knives) adorned with the hypnotically repulsive face of Bes, who often wears a distinctive plumed headdress, and shakes a rattle. The Egyptian Museum in Berlin, for instance, contains a colourful vase decorated with his mask-like features and mane-like hair.

The origins of Bes remain obscure. Perhaps he is a composite of up to 10 separate deities. From an art historical point of view, he is certainly a curiosity: unlike most Egyptian gods, who usually appear in profile, Bes is brazen and frontal, as well as comical. Some scholars suggest that he emerged in sub-Saharan Africa. It is possible that he began life as a lion or cat rearing on its hind paws.

Ultimately Bes was celebrated because he was never official or exclusive. Mischievous and irreverent (it was said that he could make babies laugh by pulling funny faces), he was resolutely down-to-earth – a god for commoners rather than royalty. Performers tattooed their bodies with images of Bes because of his associations with music and dancing, while prostitutes may have placed tattoos of Bes near their genitalia, in order to stave off sexually transmitted diseases.

By the end of the second millennium BC, Bes had proliferated across the Mediterranean world. Even local, non-Egyptian craftsmen produced objects decorated with his image. Early in the first millennium, the Phoenicians became big fans of Bes, as the Romans would too. Bes occasionally appears dressed as a Roman legionnaire. His rampant popularity even survived the advent of Christianity.

Gods and monsters

Though his influence waned around the time of Constantine, Bes still stamped himself upon Western culture. Ancient Egypt was an important source for Christian artists – imagery of the goddess Isis with her son Horus offered a prototype for representations of the Virgin and Child. In a similar fashion, Bes was an important antecedent for the Devil. Occasionally he appeared with a forked tail, a serpent, or with serpents issuing from his body – all of which would become attributes of Satan. In the mosaic of hell dating from about 1280 and attributed to Coppo di Marcovaldo in the Florence Baptistery, snakes emerge from the ears of the Devil in the largest image of Satan in Europe.

Above all, though, Bes’s grotesque expression was a model for the grisly visage of the Devil. For instance, in the glorious Byzantine mosaic of the Last Judgement in the Cathedral of Santa Maria Assunta on the island of Torcello in the Venetian Lagoon, a swivel-eyed blue ogre with a wild white beard presides over a fiery infernal lake in the bottom right corner. Just as other elements of the composition, such as the weighing of the souls, derive from ancient Egyptian art, so parts of this monster’s gruesome DNA (including his fierce face and frontal aspect) belong to an iconographical tradition stretching back to representations of Bes. Unlike Bes, the ogre is not a dwarf – but a tiny figure, whose identity remains uncertain, sits upon his lap (a visual memory, if you like, of Bes’s short stature). In addition, the ogre’s striking blue skin may recall the vivid ultramarine colour of commonplace Bes amulets, which were often made from glazed earthenware.

“We know that little amulets of Bes were exported all over the eastern Mediterranean,” says Anja Ulbrich, a curator at the Ashmolean Museum in Oxford. “So people definitely knew the image of Bes, and it may have influenced depictions of Greek demons and satyrs.”

These in turn influenced depictions of the Devil: there are obvious similarities between Satan and his sylvan forebear, the raucous Greek goat-god Pan, with his beard, hairy haunches and cloven feet. Like Bes, Pan was associated with prodigious sex. “The Church did to Pan what Stalin did to Trotsky,” the art critic Robert Hughes writes in Heaven and Hell in Western Art. “The attributes of Pan were given, in art, to the Christian Satan.” “The Christian faith had to compete with a lot of well-loved religions and cults,” Ulbrich explains. “So it demonised them.”

To the ancient Egyptians, Bes was a friendly, protective god. Yet the Christians cast him as alien and disturbing in order to demonstrate the triumph of the new faith over older customs. So next time you find yourself considering an artistic representation of the Devil – such as Giotto’s bearded, pot-bellied monster munching on sinners in the Arena Chapel in Padua – spare a thought for his art-historical forefather, Bes. If nothing else, Bes teaches us that appearances can be deceptive.

Alastair Sooke is an art critic for The Daily Telegraph

If you would like to comment on this story or anything else you have seen on BBC Culture, head over to our Facebook page or message us on Twitter.