A year and a half ago, Pedro Sánchez became prime minister of Spain after Mariano Rajoy's PP party was found to have been a beneficiary in its own corruption scandal. Now, as he tries to form a government again, it's his own party's turn to see key figures implicated in a major criminal case.

The so-called ERE case relates to money in Andalusia intended to support companies which, facing financial difficulties, looked to dismiss employees by a process known by the Spanish acronym ERE, and the affected workers themselves. The allegation is that some of this funding ended up with people close to PSOE despite, for example, their companies not having presented any ERE proceedings, or them having never been employed by the relevant businesses.

After nine years of investigation, the first sentence in the case has been released. They come from the political section, one of the 146 sections the case is divided into. It had seen 21 former senior officials of the Andalusian government charged, including former presidents Manuel Chaves and José Antonio Griñán. Both were today convicted, with Griñán sentenced to six years in prison and Chaves banned from holding public office for nine years. The sentence runs to 1,700 pages, three times as many as the sentence in the Catalan independence trial.

José Antonio Griñán, president of Andalusia 2009-2013 and president of PSOE 2012-2014, has been found guilty of misconduct in public office and misuse of public funds. He has been sentenced to six years and two days in prison and banned from holding public office for 15 years and two days. Manuel Chaves, meanwhile, president of Andalusia 1990-2009 and president of PSOE 2000-2012, was found guilty of misconduct in public office. He has been banned from holding public office for nine years.

Former Andalusian ministers Antonio Fernández, Francisco Vallejo, José Antonio Viera, Carmen Martínez Aguayo, Agustín Barberá and former deputy minister Jesús María Rodríguez have been sentenced to between six and eight years in prison each. Gaspar Zarrías and Magdalena Álvarez, also former ministers, have been banned from holding public office for nine years.

The sentences, from the Seville Audience, can be appealed to the Supreme Court in Madrid. Defence counsel have already announced they will do so. As such, none of the politicians will enter custody for the moment. Two of those charged have been acquitted: former comptroller general of the Andalusian government Manuel Gómez and former head of the Andalusian government's legal office Francisco del Río.

When it comes to the two former presidents, the judges find that although they didn't personally benefit from the scheme, they were aware of it. For his part, Chaves knew of and allowed the actions to go ahead. As for Griñán, he's found to have done nothing to stop it, even being aware of warnings from the Andalusian comptroller general's office. "The accused was fully conscious of the clear illegality of the actions in which he participated, related in the proven facts," the Audience writes in both instances.

According to the judge, the fraud was worth as much as €680 million (£580 million; $750 million). They describe the ERE system as "totally opaque" and as having ignored the checks established by the comptroller general's office. The trial saw stories of the spending of public funds on cocaine and prostitutes, phantom companies and a network of hundreds of businesses, advisers, lawyers and employers involved.

The judges write that "the political need to give a quick response to the great social-labour conflicts led those in charge at the Andalusian government to establish an agile system, although that agility was achieved by eliminating the legally established control mechanisms."

Both Chaves and Griñán, who had been presidents of Andalusia for 23 years between them, stepped down from their respective seats in the Madrid Congress and Senate and left PSOE in 2015, after being charged.

The release of the sentences today comes almost a year after the trial ended last December. That trial had lasted some 152 sessions. As many as 507 people are charged in total in a case running to 14,276 folios divided into 38 main volumes and seven volumes of annexes.