Russia wanted Trump to win. And it wanted to get caught.

In hindsight, it’s natural to think that Russia’s primary aim was to achieve the upset Trump victory we now know occurred. But if they were relying on the same polls as the rest of the world, they would have regarded that as a long-shot. It seems at least as likely that they hoped a strong showing would position a defeated Mr. Trump as a thorn in Mrs. Clinton’s side, casting a pall over the legitimacy of her administration by fuming publicly about how he had been cheated. (They probably could not have imagined that Mr. Trump would do this even in victory, insisting without any evidence that he had lost the popular vote only because of voter fraud.)

If we run with the hypothesis that Russia’s core goal was to sow doubt about the integrity and fairness of American elections — and, by implication, erode the credibility of any criticism aimed at Russia’s — then the ultimate exposure of their interference may well have been viewed not as frustrating that aim but as one more perverse way of advancing it.

Similar logic might account for Russian cyberattacks on many state voter registration systems — first reported in June and more recently confirmed by Department of Homeland Security officials.