Embroiled in a financial scandal and hemorrhaging support from members of his own party, the mayor of Rome, former surgeon Ignazio Marino, resigned Thursday evening, saying that he only had “the best interests of Italy’s capital” at heart.

The announcement came exactly two months prior to the beginning of the massive “Jubilee Year of Mercy,” expected to draw more than 30 million visitors to Rome.

Earlier Thursday, Matthew Orfini, president of Marino’s Democratic Party sent him a message: “It’s over. Better step down.”

Undaunted till the end, Marino refused to admit defeat. “My resignation is not a surrender,” he said, “and I am afraid that after I am gone mafia corruption will return.”

He even left a door open, just in case things miraculously should turn around in the meantime.

“I present my resignation knowing that these can legally be withdrawn within twenty days. This is not my trick. It is simply a reality check, to see whether the political situation can be rebuilt.”

In a rip at his own leftist Democratic Party, Marino asserted that he had torn “the capital from the right that had held and abused it for five years, muddying it to the point of allowing even mafia-like criminal activities,” saying that if it hadn’t been for him, the corrupt mafia system “would have overwhelmed not only the entire Democratic Party but the whole government.”

Marino’s popularity has been in steady decline for months, in large part due to what was perceived as his woeful management of the city, which has been visibly going to seed.

“Rome is on the verge of collapse,” Giancarlo Cremonesi, the president of the Rome Chamber of Commerce, said over the summer. “It is unacceptable that a major city which calls itself developed can find itself in such a state of decay.”

Marino had been constantly pilloried in the Italian press, first for mismanagement of the city, next for unpaid parking tickets, then for a string of mafia scandals related to his office, then for a financial imbroglio involving tens of thousands of euros in credit card receipts for dinners on the taxpayers’ dime, and recently even for getting caught out in a lie—saying Pope Francis had invited him to America to be present for his visit.

Marino, in fact, traveled to Philadelphia in late September to be present for the last leg of Pope Francis’ visit, apparently hoping to boost his popularity by being seen as Francis’ ally.

Marino had told reporters that he had been invited by the Pope, which, however, Francis flatly denied. “I did not invite Mayor Marino. Is that clear?” Francis told journalists during his flight back to Rome from Philadelphia.

Clearly exasperated, the Pope added, “I didn’t do it, and I asked the organizers, and they didn’t invite him either. He came. He claims to be a Catholic, and he came spontaneously,” he said.

The Italian press went to town on the news, saying that Francis had unmasked Marino’s lie and considering the remark a papal endorsement of the common opinion of the mayor’s incompetence. The Italian daily Il Tempo even ran with the headline “The Pope Excommunicates Marino.”

The Pope’s dislike for Marino stemmed at least in part from the mayor’s overt support for gay marriage and euthanasia. Marino has been insistent in recognizing same-sex marriages that were performed abroad, despite the fact that Italy itself does not allow such unions.

Pushing the point still further, the satirical Italian radio show, La Zanzara (The Mosquito), made a crank call last week to a high-ranking Vatican official to ask about the Marino controversy.

Posing as Italian Prime Minister Matteo Renzi, the caller spoke in a heavy Tuscan accent and asked Archbishop Vincenzo Paglia, head of the Pontifical Council for the Family and top organizer of the Pope’s Philadelphia event, how things had really gone with Marino during the trip.

“He [Marino] wanted to take advantage of it and this really upset the Number One,” Paglia said, referring to Pope Francis.

Paglia said that Marino had “crashed the party” and added that “the Pope was furious.”

With Marino’s resignation, Rome will need to scramble to prepare for the upcoming Jubilee Year of Mercy, which begins December 8, bringing rivers of pilgrims to the city.

With public transportation efficiency at an all-time low and little evidence of a comprehensive plan for the huge influx of visitors, Marino’s successor will have his work cut out for him.

Follow Thomas D. Williams on Twitter @tdwilliamsrome.