Mariano Rajoy was ousted as Spain’s prime minister on Friday after a vote of no confidence in Parliament.

The vote was led by the Socialists, the main opposition party, but ultimately the cause of his downfall was a long-running corruption scandal that had tainted his right-wing Popular Party.

He is now the first prime minister in modern Spanish history to be unseated by a no-confidence motion. How did it all unfold?

A political party under siege

Spain’s Popular Party held power from 1996 to 2004, and again from 2011 onward. But a complex corruption scandal has long plagued the public perception of the party.