City officials said they were spurred to act in part by images broadcast around the world from the festival last year of women lifting their tops and being groped by men as they were held up in the crowds.
"Some people have the wrong idea about what San Fermin is. San Fermin is not an open bar where you can do anything you want and touch women freely,"
Pamplona city councillor Gabriel Viedma, who is responsible for safety issues, told AFP.
For the first time, a team of police focused specifically on preventing sexual assaults on women has been deployed to patrol the streets during the centuries-old festival which was immortalised in Ernest Hemingway's 1926 novel "The Sun Also Rises".
Undercover police detained a 22-year-old American man from New Jersey in the early hours of Wednesday who they saw groping the behind of a woman in a packed street in the historic centre of Pamplona.
When the officers moved to arrest him, the man "sprung" at a female police officer and touched her private parts, police said in a statement.
Police also filmed the "chupinazo" — the frenetic opening ceremony on July 6 of the nine-day festival that sees thousands of revellers packed into the square in front of the town hall spray each other with cheap wine — this year from apartment balconies to help identify perpetrators of sexual assaults.
"We are very focused on ending this scourge," Pamplona mayor Enrique Maya said last month when the campaign against sexual assaults at San Fermin was unveiled.
Bars, restaurants, cafes and store windows across the city of some 300,000 people display posters bearing the symbol of a red hand against a white backdrop with the slogan "For a fiesta free of sexual abuse and harassment" written in Spanish, English and French.
Pamplona city hall distributed 2,000 posters with the image, as well as 10,000 postcards and 2,300 T-shirts in a public awareness campaign carried out jointly with local women's groups.
The groups have in the past carried out their own campaigns against sexual assaults at the festival but this is the first time they have joined forces with city hall to tackle the issue.
"There are behaviours that are not acceptable during the rest of the year, and during the festival they shouldn't be acceptable either," Zurine Altable, an activist with the Bilgune Feminista women's group which worked on the campaign, told AFP.
"Unfortunately for many years Pamplona was sold as a lawless city during San Fermin. The goal is to change that image because not everything goes. No is no. Women have the right to impose limits," she added.
Pamplona city officials acknowledge that groping and other forms of sexual harassment take place at the festival, but said the problem was not as widespread as it appeared in the media.
"Sexual assaults happen here in far smaller numbers than in other festivals of a similar size. What is certainly true is that they are absolutely condemnable and we have to work to eradicate them," Pamplona city councillor Fermin Alonso, who is responsible for cultural activities, told AFP.
Viedma said police received "six or seven" formal complaints from women for groping or other forms of sexual harassment during last year's festival. Many more women informed police of incidents without pressing charges, he added.
There were no formal complaints of rape, he said. Figures for this year are not yet available.
Jeannie Mark, a Canadian travel blogger who took part in a Pamplona bull run in 2012 and has visited 30 countries, said that while some men make "poor choices" under the guise of 'anything goes' and the drinking at San Fermin she would "absolutely" return to the fiesta and has recommended it to other women.
"It's a euphoric, intense experience," she said.
Pamplona city hall has vowed to keep up the fight against sexual assault at San Fermin.
"This is the beginning of what will be a long path," said Pamplona city councillor Ana Lezcano.