In two weeks, Donald J. Trump is to emerge from an arched portal of the United States Capitol to once again take the presidential oath of office. As the Inauguration Day ritual conveying the peaceful transfer of power unfolds, he will stand where the worst of the mayhem of Jan. 6, 2021, took place, largely in his name.

Directly behind Mr. Trump will be the metal-and-glass doors where protesters, inflamed by his lie that the 2020 election had been stolen from him, stormed the Capitol with clubs, chemical irritants and other weapons. To his left, the spot where roaring rioters and outnumbered police officers fought hand to hand. To his right, where the prostrate body of a dying woman was jostled in the bloody fray.

And before him, a dozen marble steps descending to a lectern adorned with the presidential seal. The same steps where, four years earlier, Trump flags were waved above the frenzied crowd and wielded like spears; where an officer was dragged facedown to be beaten with an American flag on a pole and another was pulled into the scrum to be kicked and stomped.

In the wake of the attack on the Capitol, Mr. Trump’s volatile political career seemed over, his incendiary words before the riot rattling the leaders of his own Republican Party. Myriad factors explain his stunning resurrection, but not least of them is how effectively he and his loyalists have laundered the history of Jan. 6, turning a political nightmare into a political asset.

What began as a strained attempt to absolve Mr. Trump of responsibility for Jan. 6 gradually took hold, as his allies in Congress and the media played down the attack and redirected blame to left-wing plants, Democrats and even the government. Violent rioters — prosecuted, convicted and imprisoned — somehow became patriotic martyrs.