At 3 a.m., the American novelist F. Scott Fitzgerald observed in “The Crack-Up,” even the smallest problem troubling the mind can take on “the same tragic importance as a death sentence.”

Fitzgerald’s 1936 essay for Esquire magazine on the toll American celebrity took on him seems like good background reading for anyone trying to parse Donald Trump’s bizarre decision to get up early, or stay up late, to lash out at Alicia Machado, the former Miss Universe he repeatedly mocked for gaining weight after she won his beauty pageant.

After ranting at 3:20 a.m. about media reports that quoted unnamed advisers to his campaign admitting that he performed poorly in Monday’s debate — in which Hillary Clinton cited his public humiliation of Machado as part of a pattern of abusive behavior toward women — Trump at 5:14 a.m. sent a series of tweets casting aspersions on the former beauty queen’s sex life and citizenship.

Since Trump cannot plausibly deny the charge Clinton leveled against him in the debate — that he tried to shame Machado into losing weight by inviting dozens of photographers to watch her work out — his Twitter assault focused instead on attempting to sully the former beauty queen’s character. Voters, the would-be president advised, should “check out” Machado’s “sex tape and past.”

Machado, however, has not appeared in a sex tape, if the definition of that term is a private recording of explicit sex leaked to the public. What voters who take the Republican nominee’s advice will find on YouTube instead is an R-rated scene from a Spanish reality television show, “La Granja,” that Machado took part in in 2005.

That scene, in which Machado appeared to have sex with another contestant under a blanket, was not secret — it was broadcast on television 11 years ago — but it has been passed around on social networks by Trump supporters since the debate as if it were proof of something. While it certainly might prove that Machado is, as she admitted to Anderson Cooper this week, “no saint,” it is hard to see how her sex life might somehow justify Trump insulting her for being overweight years earlier when she worked for him.

It is unclear what led the candidate, a reality TV star himself, to confuse a scene from a television broadcast with a sex tape, but the episode was filmed in the green-hued, nightscope video familiar to people, like Trump, who have viewed Paris Hilton’s sex tape. (In a 2003 radio interview, the Daily Beast reported, Trump told Howard Stern that he had watched the Hilton sex tape in the company of his future wife, Melania.)

Trump’s dig at Machado’s “past” appears to reference a rumor that she might have helped a former boyfriend flee his sister’s funeral in Venezuela in 1997 after shooting his brother-in-law. As PolitiFact explains, Machado’s then-boyfriend, Juan Rodriguez, claimed that his sister had been driven to suicide by her husband, Francisco Sbert — the man he shot at her funeral. Machado, however, was not charged, for lack of evidence.

Another aspect of Trump’s attack on Machado, his evidence-free suggestion that she might only have gotten U.S. citizenship with Clinton’s help, was characterized by the rival campaign as an “unhinged” conspiracy theory and revealed a temperament unworthy of a potential president.

“The Republican candidate and his campaign,” Machado responded on Instagram, “are attempting to revive slanders and false accusations about my life, in order to humiliate, intimidate, and unbalance me.”

“I became a United States citizen,” she added, “because my daughter was born here and because I wanted to exercise my rights, among them, I wanted to vote.”

Trump’s suggestion that voters should not listen to celebrities with tabloid-worthy sex lives is particularly bizarre given that his own fame was built on exactly that sort of coverage of his own life, which he fueled by cultivating gossip columnists and making regular appearances on Howard Stern’s radio show.

His hypocritical attempt to distract from his past fat-shaming of Machado by now slut-shaming her, however, is a familiar tactic. Last year, when Trump was enraged at Megyn Kelly — for suggesting, presciently, that Hillary Clinton would make his history of insulting women an issue — he turned to the same page in his playbook.

Four days after the Republican primary debate in which Kelly had asked Trump how he would deal with the charge that he is part of a war on women, the candidate posted an angry tweet with a link to a bawdy chat the Fox News anchor took part in — with Howard Stern.

Nearly six months later, on the day he skipped a Fox News debate in Iowa because Kelly was a moderator, Trump retweeted a supporter’s meme attempting to slut-shame her too.