ROME (Reuters) - An Italian judge on Saturday acquitted Rome mayor Virginia Raggi of false testimony in a trial over a senior job appointment within city hall, defusing a possible crisis for her party, the ruling 5-Star movement.

FILE PHOTO - Mayor of Rome Virginia Raggi speaks at the 5-Star Movement party's open-air rally at Circo Massimo in Rome, Italy, October 20, 2018. REUTERS/Max Rossi

Raggi was elected mayor in 2016 in a vote that was seen at the time as a major breakthrough for the 5-Star, which has always promoted a squeaky clean image and promised to clean up the corruption-riddled Italian capital.

The 40-year old mayor was accused of lying about her involvement in the nomination of the director of the city’s tourism department, Renato Marra, brother of one of her closest aides. Prosecutors had asked for a 10-month prison sentence.

“This sentence clears away two years of mud slinging. We will now go ahead, with our head held high, for Rome, my beloved city, and for its citizens,” Raggi said on Twitter.

The judge said Raggi was not guilty because she was either not aware she was committing a crime or did not know the real facts surrounding Marra’s appointment.

Raggi hugged her husband and city councillors standing with her in the courtroom after the judge read out the verdict.

The 5-Star code of ethics says its elected officials have to resign if they are convicted, meaning Raggi would have had to step down if the ruling had gone against her, throwing city hall into chaos and leaving her party open to ridicule.

Deputy Prime Minister Luigi Di Maio, who is also leader of the 5-Star, said Raggi had been “massacred” and accused journalists of being “worthless jackals” for suggesting in their reports that his party dump Raggi.

“The true plague of this country is the majority of the media, intellectually and morally corrupt, which is waging war against the government, trying to make it fall,” Di Maio added on Facebook.

Raggi’s many critics say she has made little if any progress since taking office in resolving Rome’s myriad problems, including a decrepit transport network, pot-holed roads and an inefficient garbage service.

Thousands of people staged a demonstration in front of city hall last month, denouncing the ragged state of the city, but Raggi dismissed the protesters and said she was making good headway in her job.

Over 2 million Rome citizens will be called on Sunday to vote in a referendum to decide whether the city’s public transport services, run by a municipality-owned and bankrupt company, should be opened up to other companies.