MADRID (AP) — The conviction of more than two dozen Spanish businesspeople and officials in a major corruption scandal triggered political turmoil Thursday after the court ruled that the country's governing party benefited from the biggest kickbacks-for-contracts scheme in four decades of democratic rule.

The National Court's decision is a significant blow for Spanish Prime Minister Mariano Rajoy's Popular Party, which was fined 245,000 euros (US$ 287,000) over the illegal scheme that was in place between 1999 and 2005. It is the first such conviction for a Spanish political party.

The leader of the Ciudadanos party that has so far backed the PP in parliament announced that his party will consider revising its support, saying Thursday's judicial decision "changes everything."

"The situation is grave because Spaniards deserve stability, but also cleanliness," Albert Rivera said.

Francisco Correa, the businessman considered the scheme's mastermind, was sentenced to nearly 52 years in prison, while Luis Barcenas — who was the Popular Party's accountant for three decades and a PP senator — received a sentence of 33 years and was ordered to pay more than 44 million euros in fines.

A panel of three judges also fined a former health minister and close aide to Rajoy, Ana Mato, for accepting gifts, but didn't find any wrongdoing by current members of the government.

The party immediately announced it would appeal the part of the verdict that found it was a profit-seeking participant in the scheme.

The prime minister's office also said in a statement that nobody in the current administration or in the party's leadership "was aware, and even less covered up, any irregular practice" and that Thursday's verdict is a civil fine that "expressly implies the lack of knowledge and therefore the absolute absence of any criminal responsibility."

Rajoy, who last year became the first Spanish prime minister in office to testify as a witness, had told the court he wasn't aware of the party's accounting practices when the illegal funding scheme was in place. Rajoy was the party's vice secretary general and then its secretary general until 2004.

Altogether, 29 of 37 defendants in the case were convicted on Thursday for tax evasion, fraud, money laundering, misuse of public funds and abuse of power, among other crimes, and sentenced to a total of 351 years in prison.

In a ruling of nearly 1,700 pages, the court acquitted eight of the defendants. One of the three magistrates said that four more should be acquitted and voted against convicting PP as a beneficiary of the scheme.

Correa, 62, was found guilty of controlling the network of aides and companies that arranged travel and organized events for PP in exchange for public contracts. Pablo Crespo, a key aide to Correa, was sentenced to more than 37 years in prison.

Barcenas, who resigned as party treasurer in 2009 but kept his seat in the country's Senate for another year and an office in the party's headquarters until 2013, admitted during the trial that he kept the illegal party funding hidden and said that top officials were aware of the illegal contributions. The party denied the claims.

Rajoy has said he never met Correa and that he was the one who, as party president in 2004, ordered a halt to contracts with Correa's companies upon learning that they were misusing the conservative party's name.

The case is part of a wider probe looking into allegations that high-ranking PP officials received illegal bonuses that Barcenas administered. Rajoy has said the allegations are "absolutely false" and that all additional payments to PP legislators were taxed.

Rajoy, who has steered Spain out of its worst economic crisis in decades, came to power in 2011 with a promise of economic growth and job creation. His minority government has been threatened by the entrenched conflict with Catalan separatists and the rise of a fresh political opposition by the business-friendly Ciudadanos party, but it scored a major win this week when the Spanish parliament passed a new national budget.

The 2018 spending plan victory in theory allows him enough room to maneuver until the end of his term in 2020, but Ciudadanos leader Rivera's criticism has increased in step with his party's newfound popularity in recent polls.

__

This story has been corrected to show that Barcenas was fined 44 million euros, not 4 million.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.