Spain’s Prime Minister, Mariano Rajoy was this Friday  ousted by the country’s parliament in a vote of no confidence following a corruption scandal.

The vote of no confidence came after 29 former members of Mr Rajoy’s conservative Popular Party were convicted of corruption last week. Spain’s National Court said bribes were offered to former Popular Party officials in exchange for public contracts.

The 63-year-old Rajoy had earlier admitted defeat ahead of the vote on Friday morning and would depart after six-and-a-half years as the country’s leader.

With his ouster, Rajoy becomes the first Spanish prime minister to lose such a vote since Spain transitioned to democracy in 1977.

The no-confidence vote hands power to the opposition Socialists, whose leader, 46-year-old Pedro Sanchez is set to be appointed as Rajoy’s successor after King Felipe VI swears him in on Monday.

Mr Rajoy, who was one of Europe’s longest-serving leaders, told the Spanish parliament he was proud of his record.

“It has been an honour to leave Spain better than I found it. Thank you to all Spaniards and good luck,” he said.

The party also received a hefty fine as a beneficiary of the kickbacks-for-contracts scheme.

Mr. Rajoy became Spain’s first sitting prime minister to stand as witness in a trial over the corruption cases, believed to have taken place between 1999 and 2005