Moscow, Russia (CNN) -- Russian President Dmitry Medvedev has fired the long-standing mayor of Moscow, saying he has lost confidence in the latter's ability to run the city, the Kremlin said Tuesday.

Yuri Luzhkov has run the sprawling metropolis for almost two decades. His removal was effective immediately, the Kremlin said, and his first deputy, Vladimir Resin, was appointed acting mayor.

In recent weeks, Luzhkov has been the subject of an unprecedented attack in Russia's state media.

The most serious accusation is of corruption: One news report detailed ways in which Luzhkov allegedly channeled funds and lucrative deals to his property-developer wife, now Russia's richest woman.

He was also criticized for failing to curb Moscow's notoriously bad traffic jams, and for going on a vacation during the forest fires and choking smog that plagued residents over the summer.

In a letter written to an executive of the pro-Kremlin United Russia party -- which Luzhkov helped create -- the mayor said his removal was politically motivated.

"I have been subjected to violent attacks from the state-owned media recently as a member of the bureau of the party's Supreme Council," said the letter, addressed to Andrei Vorobyov and distributed by the mayor's office to Russian news agencies.

"The attacks stemmed from the aim of removing the Moscow mayor from the political arena and stripping him of his powers ahead of time," Luzhkov said. "For over a month, I was subject to wild harassment that went beyond the limits of decency and common sense."

Luzhkov also denounced the United Russia party for not offering any support to him and for failing to "demonstrate any willingness to look into things and stop the flow of lies and slander."

"I ask not to be considered a member of United Russia any longer," said the former mayor.

Luzhkov had been at odds with Medvedev, most recently over the Kremlin's decision to suspend work on a controversial highway project through a Moscow forest.

At a political event earlier this month, CNN asked Luzhkov about the latest allegations and whether the Kremlin was trying to push him out.

"Would you mind if I do not answer that question?" he responded.

With Luzhkov's ouster, Medvedev has completed his task of removing, one by one, an entire generation of strongly-entrenched, Yelstin-era regional leaders who had been clinging to power for many years and sometimes decades.

CNN's Matthew Chance, Maxim Tkachenko and John Dear contributed to this report.