The origin of the fiesta of San Fermín goes back to the Middle Ages and is related to three celebrations: religious ceremonies in honour of San Fermín, which intensified from the 12th century onwards, trade fairs and bullfights, which were first documented in the 14th century. Initially, the fiesta San Fermín was held on October 10th, but in 1591 the people of Pamplona, fed up with the bad weather at that time of year, decided to transfer the fiesta to July so it would coincide with the Fair. This is how the Sanfermines were born. It initially lasted two days and had a pregón (opening speech), musicians, a tournament, theatre and bullfights. Other events were added later, such as fireworks and dances, and the fiesta lasted until July 10th.
Chronicles from the 17th and 18th centuries tell us of religious events together with music, dance, giants, tournaments, acrobats, bull runs and bullfights, and the clergy's concern at the excessive drinking and dissolute behaviour of young men and women. They also refer to the presence of people from other lands, whose shows "made the city more fun". In the 19th century there were curious fairground attractions such as a woman fired from a cannon, exotic animals or wax figures, while the Comparsa de Gigantes (parade of giants) had new carnival figures with big heads, kilikis and zaldikos. Furthermore, the absence of a double fence in the bull run meant that the bulls escaped on several occasions and ran around the city streets.
The Sanfermines reached their peak of popularity in the 20th century. The novel "The Sun Also Rises" ("Fiesta"), written by Ernest Hemingway in 1926, attracted people from all over the world to come to the fiesta of Pamplona. The 20th century also witnessed new events within the fiesta such as the Riau-Riau (suspended since 1991), the Chupinazo, or the cultural programme.