TWO days before America’s presidential election, Dmitry Kiselev, the television host who serves as Russia’s propagandist-in-chief, announced that whichever candidate emerges victorious, the real winner will be the Kremlin. Wearing a tight suit and a self-satisfied smirk, Mr Kiselev drew three conclusions. First, the campaign was the dirtiest in America’s entire history, and made a mockery of the country’s political system: “It was so horribly noxious that it only engenders disgust towards what is still inexplicably called a ‘democracy’ in America.” Second, whoever wins the election will be a “lame-duck” president, facing an impeachment effort from the very start. Third, the occupant of the White House will lack legitimacy.

The wounds Mr Trump has inflicted on Hillary Clinton will destroy her political viability, opined Mr Kiselev. But “even if Mr Trump wins, Mrs Clinton will declare his victory illegitimate and will sabotage his presidency, so his victory will be a Pyrrhic one. Neither of the candidates will be a president of the whole of America.” This does not mean that America will change its course: the power of its security services in the decision-making process will drive it to continue an expansionist, militarist foreign policy.

As Mr Kiselev’s commentary made clear, the Kremlin’s main objectives are to discredit the institutions of democratic elections and the free press, and to weaken both candidates as much as possible. In late October, Mr Putin told an international audience at the Valdai discussion club, an annual gathering of Russia experts, that his country was unable to influence the outcome of the American elections. But while Russia may not be able to determine who wins the contest, it can certainly help make it look messy and damage the brand. To this end, the Kremlin has hacked the computer systems of the Democratic Party, fed stolen documents to the increasingly Kremlin-friendly digital dumpers at WikiLeaks and pumped out hours of propaganda material through RT, its foreign-language television channel.

To Mr Putin, all of this is retaliation for what he sees as American interference in Russian domestic politics. He still resents sarcastic comments Mrs Clinton made years ago over his constitutionally dubious move to serve a third term as president beginning in 2012; and he believes America stirred up the wave of anti-government protests which broke out after legislative elections in late 2011. Mr Putin has long understood that the biggest threat to his rule is posed not by any particular candidate, but by the very idea of free and competitive elections. So his main goal is to present America’s elections as a destabilising process that Russia should avoid.

A victory by Mr Trump would be a bonus. The Kremlin has given much airtime to his vow during the campaign to “stop trying to build foreign democracies, topple regimes and race recklessly to intervene in situations that we have no right to be there.” This was music to Mr Putin’s ears. But whether a victorious Mr Trump carries on with his pledge to repair the relationship with Russia or turns out to be erratic and hostile, the Kremlin wins either way. The former would bolster Russia’s strength; the latter would allow the Kremlin to present the American president as a bogeyman and object of mockery. In any case, an isolationist America bogged down in political infighting is no threat.

Should Mrs Clinton win, the Kremlin will console itself that she is at least predictable. She will be constrained by the Republicans’ likely control of at least one house of Congress. And Russia will continue to support any attacks Mr Trump levels against her after the elections.

When he announced Russia’s withdrawal from a plutonium reduction treaty in October, Mr Putin sent the Americans an ultimatum listing three conditions for building a good relationship with the new administration. These included rolling back NATO troops to their positions before the expansion of NATO to central and eastern Europe; lifting the economic sanctions imposed on Russia after its invasion of Crimea in 2014; and repealing the Magnitsky Act, which imposes sanctions against Russians accused in the death of the lawyer Sergei Magnitsky in 2009. Neither candidate will be willing or able to meet these demands. But Mr Trump might be prepared to accommodate another Russian goal: negotiating a new understanding, like the Yalta agreement in 1945, that would allow Russia a sphere of influence over much of the territory of the former Soviet Union. Whether any such pact would lead to lasting stability between America and Russia is another matter altogether.