MADRID -- Spain's Supreme Court on Friday overruled two lower courts and sentenced five men to 15 years in prison for raping an 18-year-old woman.

The case had triggered an outcry because the lower courts last year convicted the men of the lesser crime of sexual abuse and handed down 9-year sentences.

The public prosecutor, the victim and regional authorities appealed to the Supreme Court, asking for a rape conviction and longer sentences. The men's lawyers wanted them acquitted, arguing that the woman consented.

Women's rights advocates had expressed anger about what they saw as the lower court's leniency and the confirmation of that sentence by a second court. They have held national protests since the 2017 verdict.

The judges heard both sides' arguments in a televised session Friday and gave their verdict after just two hours.

They said that, in accordance with legal precedent, the attack could be classified as rape, which was aggravated by being performed in a group.

The victim didn't consent to the acts, the judges said, and was subjected to 10 acts of sexual aggression in "a genuinely intimidating scene."

They found that the men also made videos of their attack.

Prosecutors said the men boasted about the 2016 attack during Pamplona's San Fermin festival on a WhatsApp group named "La Manada," or "The Animal Pack."

The case brought widespread criticism from women's groups after the first court agreed to study a defence detective's report on the woman's behaviour after the incident, which some said made it appear the victim was on trial.

Viviana Waisman, president of the international non-profit organization Women's Link Worldwide, which pursues social change through the law, welcomed the ruling, saying courts too often doubt the victims and fail to protect them.

She said Friday's decision "sends a clear message that judges must apply the law ... and when victims of sexual violence come forth they must be believed, not questioned."