BARCELONA — It had all the markings of a free speech showdown: Pablo Hasél, a controversial Spanish rapper, had barricaded himself on a university campus to avoid a nine-month jail sentence on charges that he had glorified terrorism and denigrated the monarchy. While students surrounded him, police in riot gear moved in; Mr. Hasél raised his fist in defiance as he was taken away.

But Oriol Pi, a 21-year-old in Barcelona, saw something more as he watched the events unfold last week on Twitter. He thought of the job he had as an events manager before the pandemic, and how he was laid off after the lockdowns. He thought of the curfew and the mask mandates that he felt were unnecessary for young people. He thought of how his parents’ generation had faced nothing like it.

And he thought it was time for Spain’s youth to take to the streets.

“My mother thinks this is about Pablo Hasél, but it’s not just that,” said Mr. Pi, who joined the protests that broke out in Barcelona last week. “Everything just exploded. It’s a whole collection of so many things which you have to understand.”

Madrid and other Spanish hubs. What began as a protest over Mr. Hasél’s prosecution has become a collective outcry by a generation that sees not just a lost future for itself, but also a present that has been robbed, years and experiences it will never get back, even when the pandemic is gone.