Donald Trump has done many shocking things during his Presidential campaign, but Friday was the first time he asked the electorate to check out an alleged sex tape. PHOTOGRAPH BY JONATHAN ERNST / REUTERS

The tweets Donald Trump sent out early Friday morning about Alicia Machado, the former Miss Universe who has emerged as an important surrogate for the Hillary Clinton campaign, raise a number of questions, and the first is: Why was Trump up all night?

At 3:20 A.M., Trump wrote, "Anytime you see a story about me or my campaign saying ‘sources said,’ DO NOT believe it. There are no sources, they are just made up lies!" A couple of hours later, in a tweet posted at 5:14 A.M., he turned his attention to Machado, saying, "Wow, Crooked Hillary was duped and used by my worst Miss U. Hillary floated her as an ‘angel’ without checking her past, which is terrible!" Five minutes later, Trump posted a follow-up: "Using Alicia M in the debate as a paragon of virtue just shows that Crooked Hillary suffers from BAD JUDGEMENT! Hillary was set up by a con." And eleven minutes after that, at 5:30 A.M., came a final message: "Did Crooked Hillary help disgusting (check out sex tape and past) Alicia M become a U.S. citizen so she could use her in the debate?"

Trump has done many shocking things during his Presidential campaign, but Friday was the first time he asked the electorate to check out an alleged sex tape. Was he brooding, fuming, suffering from insomnia, or a combination of all three? If he went to bed at all on Thursday night, we know that it wasn’t until late, because he appears to have watched Don Lemon’s show on CNN, which doesn't start until ten o'clock. At 10:16 P.M. Trump had tweeted, "Wow, did you see how badly @CNN (Clinton News Network) is doing in the ratings. With people like @DonLemon, who could expect any more?" Five hours later, he was back on Twitter.

A delighted Clinton campaign seized upon Trump's nocturnal outpourings. "I'm almost @realDonaldTrump's age, so get the urge to get up in the middle of the night, but impt safety tip: don't reach for your phone," John Podesta, Clinton's campaign chairman, wrote in a tweet posted at 8:42 A.M. By that time, the cable channels and online media were all over the case. "Oh look, Trump is dominating the news cycle again," Brian Fallon, Clinton's campaign spokesman, wrote on Twitter at 9:30 A.M. "Whatever will we do." Later in the morning, Clinton’s campaign put out a series of tweets under the candidate’s own name, the first of which said, “This is . . . unhinged, even for Trump." A second Clinton tweet asked, “What kind of man stays up all night to smear a woman with lies and conspiracy theories?”

The answer to Fallon's question, at least, is clear. The Clinton campaign will do all it can to keep the Trump and Machado story going. At Monday night's debate, Clinton brought up Machado's name unbidden, noting how, after she put on weight following her victory in the 1996 Miss Universe contest, Trump referred to her as "Miss Piggy" and "Miss Housekeeping”—the latter epithet an apparent reference to the fact that Machado is a Latina. Rather than ignoring the bait, Trump swallowed it whole. On Tuesday morning, he called in to Fox News, where he defended his offensive comments about Machado, saying, “She was the winner and she gained a massive amount of weight, and it was a real problem.” Trump's response gave the Machado story oxygen coming out of the debate, and now, thanks to his tweets, it will live on into the weekend and beyond.

Why has Trump been unable to move on? The "unhinged" theory is the most persuasive explanation, but it needs stating carefully. Trump didn't develop any new traits, or lose his mental balance, on Thursday night. Angrily lashing out at people who criticize him, regardless of the circumstances or consequences, has long been Trump’s default behavior. He didn't become unhinged. He is unhinged. "This is just who he is," Sam Stein, of the Huffington Post, pointed out on Friday's edition of "Morning Joe." "I know people think there's this three-dimensional chess happening, and he's trying to distract from another story . . . but it's not that. I think he's just personally aggrieved by what’s happening with this thing."

Stein is surely right. If Trump's tweet had been part of a devilish new strategy to blacken Machado's reputation and put the Clintonites on the defensive, his campaign would have followed up his tweets by providing at least some fresh evidence to back up his charges. It didn't. On Friday morning, his campaign manager, Kellyanne Conway, was busy retweeting stories about the Clinton e-mail scandal from Politico and the Wall Street Journal. She didn't mention Trump's messages from earlier in the day—and that was perfectly understandable. Even before this week, women and Latinos were largely against Trump. In engaging in a weeklong war with Machado, he has given members of both groups, and of other groups, new reasons to dislike him. From a political perspective, there was nothing to be gained from extending the spat with Machado. It is a repeat of Trump's damaging spat with the Khan family after the Democratic Convention.

Trump’s fight with Machado wouldn’t be smart politics even if all of the insinuations that he and others have made about her were true. As it is, they have been discredited or are in dispute.

The fact-checking outfit Snopes.com dismissed an allegation that Machado had appeared in a pornographic movie, saying the actress in an alleged video wasn't her. Snopes.com also looked into reports that Machado was filmed having sex with a fellow cast member during a 2005 Mexican reality show, concluding: "the so-called ‘sex tape’ stemming from that incident is perhaps the tamest video ever to be so termed, consisting of nothing more than some grainy, night-vision footage of a couple of covered figures writhing in a bed.” Machado has denied stories that the father of her child is a notorious Mexican drug trafficker, and that she once called up a judge who indicted a boyfriend of hers for attempted murder and threatened to have him killed. Interviewed by CNN's Anderson Cooper earlier this week, Machado said, "You know I have my past. Of course, everybody has a past. I'm not a saint girl. But that is not the point now.”

The point is Trump's character. His original comments about Machado reeked of sexism and racism. His behavior this week has highlighted, anew, his impulsiveness and lack of discipline. As the Washington Post's Paul Waldman pointed out on Friday, if Trump did somehow make it to the Oval Office, "he’d have to regularly set aside whatever impulsive reaction he has to a particular turn of events in favor of a long-term strategy that would be more beneficial to the country." Could he do that? The answer is available on Twitter.

This post was updated to clarify what Snopes.com said about the allegations against Machado.