When Hunter S. Thompson took English artist Ralph Steadman to the Kentucky Derby in 1970, he tried to prepare him for the chaos. “Just pretend you’re visiting a huge outdoor loony bin,” Thompson said. He added, “If the inmates get out of control we’ll soak them down with Mace.”

“Huge outdoor loony bin” is not the most precise description of the Palio di Siena, the thunderous, lawless, bareback, medieval-style horse race held twice each summer in front of tens of thousands of spectators on a track of packed clay laid down in the downtown heart of Siena, in Tuscany, Italy. But it will do for the moment.

This is a race in which jockeys — they ride for various contrade, or neighborhoods — feel free to bribe one another, out in the open, before the contest begins. Betrayal is common. Guile is prized. There are no rules but one: A rider may not interfere with the reins of another horse.

Jockeys whip their horses, and each other, with crops made from cured distended bull’s penises. If a jockey is thwacked off his mount, his riderless horse can win on its own.

The jockey who finishes second is held in more contempt than the one who comes in last. After the race, the victors celebrate by sucking on pacifiers or drinking cheap wine from baby bottles to symbolize rebirth. Siena comes to resemble a playpen in which many of the toddlers have hairy legs and five o’clock shadows.

A few years ago, when the Contrada Pantera (the Panther) was beaten by its long-established enemy, the Contrada dell’Aquila (the Eagle), a loudspeaker mounted on the Eagle’s church tower reportedly boomed out a motto mocking the Panther 24 hours a day for more than a month.

I know these things — they barely scratch the surface of this festival’s part-circus, part-theater ambience — because my English friend, Valentina Rice, has been attending the Palio each summer since she was a child. She tells good stories. I’ve also seen the fascinating 2015 documentary, “Palio.”

Last August, I finally witnessed this spectacle for myself. Rice, whose family has long owned a house in the Tuscan hillsides, invited me along.

Neighborhood rivalry

On a blistering August afternoon, 93 degrees in the shade, we were not in the shade. We were standing in the center of Siena’s main square, the Piazza del Campo, waiting amid a boiling sea of spectators.

Behind me, groups of men broke into ribald ballads that honor their contrade. Many women attend the Palio and take part in various aspects, but it is as strenuously male and macho as NASCAR or professional wrestling. Yet the scene is mostly peaceful and upbeat.

A solemn and highly choreographed two-hour pageant, the Corteo Storico, began. More than 600 people in historical costume, many on horseback, began moving slowly around the piazza. Many of the faces were nearly medieval in their El Greco thinness. There were skilled flag tossers, severe-looking military-style drummers, oxen-pulling chariots, floats of ancient design.

The race, which occurs twice a year, on July 2 and Aug. 16, dates back to the 13th century, and most likely began as Roman military training. The earliest races were on buffaloes, and then on donkeys. The word palio itself means banner in Italian, and that’s all that the winning contrada receives. This banner bears the image of the Virgin Mary, in whose honor these wild races are held.

Seventeen fiercely rivalrous contrade ring Siena. These tend to be named after animals: snails, porcupines, she-wolves. Each contrada has its own museum and church, public square, fountain, traditions and banner. Once there were more than three times as many contrade. One of the most moving portions of the pre-race procession is watching the banners of past contrade wind by, ghosts of earlier contests.

There may be 17 contrade, but there is room in each race for only 10 horses. A form of musical chairs must occur, and the seven contrade that cannot fit in one race are included in the next. The contrade are allowed to choose their jockeys but not their horses, all of which are mixed-breed and chosen in part for their ability not to be easily spooked. Each contrada meets its horse for the first time just four days before the race.

Jockeys take their lives into their hands. The race involves three clockwise laps around the ⅓-mile track and there are tight turns. There have been dozens of serious injuries; videos of spills are all over YouTube.

Horses are more vulnerable. More than 50 have died in these races since 1970; animal rights protesters have staged repeated protests. Palio administrators have increased the padding on some turns and instituted other safety controls. Critics say these measures are not enough.

Seconds to glory

The parade ended and a cannon-like shot scattered every bird within 2 miles. The crowd grew quiet as the horses and their riders entered the piazza. Nine of the 10 racers took up their assigned positions at the starting rope. The 10th rider decided when the race started, when he made a go for it.

While this was happening, the riders conversed, swapped taunts and offered bribes. Impatient horses jostled and reared off the crowded line and were ridden back. The 10th horse made multiple exploratory false starts. This to-ing and fro-ing took more than 10 minutes.

And then they were off. The race was a clattering blur, whipping around us. It took less than 90 seconds but seemed even shorter. Several riders fell from their horses but none were seriously injured.

The winner was La Contrada dell’Onda (the Wave), its colors aquamarine. It was this contrada’s first win since 2013 and its jockey, Carlo Sanna, known as Brigante, was an instant hero, hoisted upon shoulders.

He and his horse, the 9-year-old Porto Alabe, were whisked off to receive the winning banner and be blessed at the Siena Cathedral, the Duomo. Hundreds, if not thousands, of people poured through the streets to make their way there, as the carabinieri kept close watch.

Out came the pacifiers and baby bottles. The winners wept with happiness. Meals commenced at huge tables set up in the streets. The festivities ran all night, which frankly they’d done for the four days leading up to the race.

This outdoor loony bin is one I will happily be committed to.