There are varying theories about the origins of the Carnival in Spain, although it seems that it bear relation to the ancient customs of the Mediterranean and Celtic cultures. They celebrated the coming of spring through rituals and fancy dress and blessed the change of season and the better weather.
Despite the hazy origins, most historians and ethnologists place its roots in Ancient Rome. The Saturnales in honour of the god Saturn were celebrated in December with role-swapping of different social levels. Fancy dress and masks hid the real identities and the different classes, sexes and professions mixed together in a playful confusion.
Given the importance of these festivals the courts of law were suspended, and military activities were put on hold. The only figure who commanded respect during the celebrations was the "Saturnal King", a comical character protrayed these days in the form of Carnestoltes.
Look closely at the dates another inspiration could be the Lupercales, festivals dedicated to the god Pan and celebrated in the middle of February.
The most important event of these celebrations was the building of a vessel, called Carrus Nivalis, in honour of the goddess Isis. This led to historians looking into the origins of Carnival to think about the parallel between the story of Isis and Osiris and the "Passion", the story of the death and resurrection of Christ.
Looking at the roots of specific Carnival words and phrases. A word like Carnestoltes refers to the traditional prohibition of meat eating during Lent and the last days in which meat could be eaten.
This character, who represents Carnival, originated in Catalonia in the seventeenth century. Originally he was a straw figure that country folk hung from their barns during Carnival week. On Ash Wednesday the figures were set on fire, symbolizing the end of the celebrations.
This character gained importance in Barcelona in the 19th century and was transformed into the Carnival King seen in Catalonia today, symbolizing wildness, lust and irony. A series of ceremonies are organized around him: his arrival at the start of Carnival, his sermon, his presidency over the festivities, his death and his inevitable last wish, which invites the people to put an end to the fun and begin the days of religious reflection and devotion which we call Lent.