In Catalonia, hidden among the traditional nativity characters is a little figure, trousers down, doing his business right in the middle of the holy scene.

A pessebre, a Catalan nativity scene, contains all the usual suspects. There’s Mary and Joseph gazing down lovingly at baby Jesus, sleeping in his manger. There are the oxen, gently lowing, and perhaps some shepherds. But look closer, and hidden among the traditional characters is a little figure, trousers down, doing his business right in the middle of the holy scene.

The caganer – literally ‘defecator’ – is a staple of Christmas in Catalonia in north-east Spain. The traditional figure depicts a peasant wearing black trousers, a white shirt and the classic red Catalan cap – the barretina. He may also be smoking a pipe and reading a newspaper.

It’s like the funny part of something that is supposed to be very serious

“It’s like the funny part of something that is supposed to be very serious – the nativity,” laughed caganer collector Marc-Ignasi Corral, 53, from Barcelona. Yes, the figure is so popular it even has its very own society, the Friends of the Caganer Association (L’associació Amics del Caganer), of which Corral is a proud member. Founded in 1990, the society has around 70 members – some from as far afield as the US – who meet twice a year.

Traditional caganers are made from clay, fired in a kiln of more than 1,000C, then hand-painted. As the industry has grown, the caganer has evolved; now there are many different kinds, both in design and material.

“I’ve got ones made of soap, I’ve got chocolate ones, but those are meant to be eaten of course,” said Corral, whose bookshelves are dotted with his collection of more than 200 caganers. “I’ve got glass ones… I’ve seen them made from Nespresso capsules.”

You may also be interested in:
• Is this where Santa is really from?
• Europe’s terrifying Christmas tradition
• The Guatemalan deity of vice

Firmly planted in folk tradition, the roots of the caganer are vague, but generally agreed to date from around the late 17th or early 18th Century when the prevailing Baroque tradition, both in Catalonia and beyond, focused on realism in art, sculpture and literature. In their book El Caganer, authors Jordi Arruga and Josep Mañà write: “This was a time characterised by extreme realism… all of which relied heavily on descriptions of local life and customs. Here, working conditions and homelife were used as artistic themes.”

One real-life depiction was the caganer.

The reason it has been passed down the generations, however, is clear: the idea of defecating has long been linked to everything from good luck to prosperity to good health.

“Excrement equals fertilisation equals money equals luck and prosperity. Or so say the anthropologists,” said historian Enric Ucelay-Da Cal, emeritus professor at Barcelona’s Pompeu Fabra University.

“It is said that to not put a caganer in the crib will bring bad luck,” added caganer maker Marc Alos Pla, whose family runs caganer.com, the world’s biggest caganer producer. This year he predicts sales will surpass 30,000.

And far from seeing the caganer as uncouth or even graphic, Catalans have a relaxed view of them as merely depicting a natural act.

“We don’t see it as rude. I mean as rude as when you go to the toilet,” Corral laughed. “We hide things – we’re in a society where we’re hiding everything. We hide death for instance.”

Furthermore, Catalans do not stop at one Christmas tradition.

Caga Tió, literally the ‘Defecating Log’ (also called the Tió de Nadal, the ‘Christmas Log’) is also a staple in many Catalan homes in the run-up to Christmas.

It has a pleasantly subversive quality, naughty but nice

On the feast of the Immaculate Conception, on 8 December, families start ‘feeding’ Caga Tió scraps of food. He is covered with a blanket to keep him warm until, on Christmas Eve or Christmas Day, when he has had enough to ‘eat’, the children hit him with sticks while singing a song that encourages him to defecate:

Caga tió / poo log
Caga torró, avellanes i mató / poo nougat, hazelnuts and mató (cheese)
Si no cagues bé / if you don’t poo well,
et daré un cop de bastó / I’ll hit you with a stick
Caga tió / poo log!

For the log doesn’t produce any old excrement… he defecates Christmas presents.

Before hitting the Tió, children go to another part of the house to pray for him to bring them gifts, while their parents take the opportunity to stash small treats like Christmas sweets under the blanket.

“The Tió seems to be a pretty old Christmas idea… in medieval times it was found all over Europe, from Scandinavia down to the Western Mediterranean: the idea of a ‘Yule Log’, which lasted until about World War Two,” Ucelay-Da Cal said.  

What is it about these traditions, which in other parts of the world might be seen as explicit or rude, that attracts so many Catalans?

“I love the transgression of norms, the tradition they represent and the artwork in itself,” Corral explained, while Ucelay-Da Cal said the caganer “has a pleasantly subversive quality, naughty but nice, as it were.”

In fact, the themes of defecation are reserved not only for Christmas, but run like a common thread through Catalan culture, from idioms to art.

“This fits in with a Catalan (and Spanish) taste for egalitarianism: everybody [poos], however important they may be,” said Ucelay-Da Cal.

When it comes to language, Catalan is filled with stool-related sayings and idioms. Where in English we might say two extremely close people are ‘as thick as thieves’ and in Spanish that phrase would be ‘como uña y carne’ (like [finger] nail and flesh), Catalans say two are people are like ‘cul i merda’ – backside and excrement.

“There is a cliché that Germanic languages are [full of] faecal metaphors, while Romance languages stress virility. Certainly the Spanish tradition – and very specifically Catalan scatological custom – would deny this affirmation,” Ucelay-Da Cal said.

Defecation has also appeared in Catalan art and literature going back hundreds of years.

Everybody poos, however important they may be

In his book, Barcelona, which looks at Catalan history, art and culture, art critic Robert Hughes writes that the figure of the caganer “makes an unmistakable entrance into 20th-Century art” in the work of Joan Miró.

Look closely at Miró’s 1921-22 painting The Farm, and you will see what looks like a small child squatting close to his mother while she does the washing.

This boy, Hughes writes, “is none other than the caganer of Miró’s childhood Christmases. It may also be Miró himself, the future painter of Man and Woman in Front of a Pile of Excrement (1935).”

Catalan writers, too, have long depicted the scatological, with Hughes arguing that it is firmly entrenched in Catalan folk tradition. “…There has always been a vigorous strain of scatological humour in [Catalan] folk songs, folk poetry and educated verse,” he writes.

He cites one verse in particular, in the 13th-Century Versos Bruts (Coarse Poems), which recounts a discussion between two nobles in which they describe “One hundred noble ladies who went to sea in a boat and, becalmed, got back to shore by farting in chorus into its sails.”

One area of Catalan culture you might assume stays firmly away from the scatological is food – but, inevitably, you would be wrong. Feeling peckish, you might wander into a Catalan bakery and be confronted with a popular baked good known – rather unappetisingly – as a ‘pet de monja’, or ‘nun’s fart’.

And even Catalan politics has taken a toilet-humour turn, with the region’s strong independence movement reflected in recent caganer bestsellers. Exiled former regional president Carles Puigdemont is a favourite, and in 2017, a Tweety Pie caganer sold out (when the Spanish government sent in extra police to control the 2017 independence referendum, they slept on a ship whose exterior featured a gigantic Tweety Pie).

In 2018, a caganer of a yellow ribbon sporting a pair of big eyes and a mouth depicting the symbol used in solidarity with Catalonia’s jailed independence leaders – is expected to be a bestseller.

The caganer is now turning into a way of keeping a memory of living history

“It’s a reflection of what is happening,” said Corral. “The caganer is now turning into a way of keeping a memory of living history. It’s a reality. We have political prisoners.”

While caganers have not reached the worldwide ubiquity of the Christmas tree, they are becoming increasingly well known outside Catalonia. The figures have long been a tradition in areas of Portugal and Naples, Italy, and are also gaining fans further afield.

“In the caganer society we have members from Italy, Germany, Japan, the United States, so it’s an international society,” Corral said.

In fact, around 50% of caganer.com’s foreign sales are shipped to the US, according to Alos Pla, with popular figures including Barack Obama and Hillary Clinton. Alos Pla predicts that Donald Trump and David Bowie will sell in large numbers this year.

Whether you give someone a caganer of someone they love or loathe is up to you – but many people take it as a compliment:

“For many famous people it has become an honour to have their own caganer,” said Alos Pla.

Corral is more blunt. “I mean if you don’t have a caganer, you are nobody nowadays.”

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Culture, Capital and Travel, delivered to your inbox every Friday.