Thousands of protesters have taken to the streets across Spain after a court cleared five men of the gang rape of a teenager at the 2016 San Fermin bull-running festival in Pamplona.

Key points: Five men given nine-year sentences for sexual abuse

Five men given nine-year sentences for sexual abuse Politicians condemn the ruling

Politicians condemn the ruling The annual festival draws thousands of tourists from all over the world

The court in the northern region of Navarra convicted the men, who had recorded video of the attack on their mobile phones and laughed about the incident afterwards on a WhatsApp group, with the lesser crime of sexual abuse.

The state prosecutor had asked for prison sentences of more than 20 years for each of the men. Instead they were given nine-year sentences.

The incident took place in the lobby of a building in the early hours of the morning at the San Fermin festival, which brings more than 1 million people to Pamplona for the nine-day festival in July.

One of the men stole the woman's mobile phone following the attack, leaving her with no means of contacting the friend with whom she had come to the festival.

She was found crying on a bench by a couple who rang the police when she said she had been sexually assaulted. She made a statement to the police, describing the five men who were later arrested.

Fragments of video from the men's mobile phones taken at the scene were used as evidence in the trial, alongside witness accounts and biological tests. The defence team argued the incident was a case of consensual group sex.

In Madrid, men and women packed central streets chanting "Shame! Shame!" and "No means no". ( AP: Francisco Seco )

Under Spanish law, the lesser charge of sexual abuse differs from rape in that it does not involve violence or intimidation.

The charge is used in cases of sexual activity between underage partners or those seen not capable of giving permission for sexual contact, such as those who are severely handicapped or under the influence of drugs or drink.

The decision drew immediate criticism and outrage. Thousands gathered in cities across Spain — from Seville to Barcelona and outside the Justice Ministry in Madrid — bearing notices reading "I believe you, sister" and chanting, "It's not abuse, it's rape".

In Madrid, men and women packed central streets chanting, "Shame. Shame" and, "No means no".

Politicians across the spectrum condemned the ruling.

"As a citizen and as a father, I find it hard to understand this sentence," Albert Rivera, head of market-friendly political party Ciudadanos, tweeted.

"It seems to be saying to victims that if you don't take on five thugs double your size, putting your life at risk, it's not rape," Pablo Iglesias, leader of left-wing Podemos, said.

The case had already sparked widespread anger around Spain following concern over increased reports of sex attacks at the annual festival and over the mistreatment of women in general.

It has also drawn international attention, coming at a time of heightened global concern over the sexual abuse of women in the wake of the Harvey Weinstein scandal.

A picture of the accused is seen on screen in the Navarra courtroom. ( Reuters: Vincent West )

Regional Government will appeal against ruling

The five-month trial was held behind closed doors to protect the victim's identity.

The five men, including a former policeman and a former soldier, and the victim, who was 18 at the time of the incident, were not present in court.

The men, dubbed by Spanish media The Wolf Pack after the name of their WhatsApp group, have been held in custody since July 2016.

The judge, who did not give the reasoning behind the sentence, also ordered the men to pay the victim 50,000 euros ($80,112) in compensation. The ruling can be appealed in Spain's Supreme Court.

Navarra's regional Government, where the San Fermin festival takes place, will appeal against the ruling, a government spokeswoman said.

The Running of the Bulls involves hundreds of people running down narrow streets in front of fighting bulls. ( Reuters: Susana Vera )

The Running of the Bulls involves hundreds of people dressed in white shirts and red neckerchiefs running down narrow streets in front of fighting bulls before ending in the city's bull-ring, where bullfights take place in the afternoon.

The festival is just as famous for the drinking and revelry on the sidelines, with huge street parties, processions and firework displays. The event draws thousands of tourists from all over the world.

Reuters