LAS VEGAS — At one of the last debates during the Republican primary, rival Ted Cruz turned to Donald Trump and asserted he was too cozy with Hillary Clinton to take her on — much less take her down — in a presidential debate.
Trump shot back that he was ‘‘the last person that Hillary Clinton wants to face.’’
By May, Trump was getting downright cocky. ‘‘I sort of wish we had more than three,’’ he boasted on CNBC.
But at the end of the third debate Wednesday night, it was clear that Cruz had been correct, if for different reasons: Trump proved to be no match for Clinton.
For the first hour or so of a confrontation here that he desperately needed to turn into a referendum on Clinton, Trump advanced a methodical contrast of their views on guns and the Supreme Court and offered an aggressive, if shaky, critique of Clinton’s record on immigration abortion and other matters.
But he appeared rattled at times by her jabs and then fell back into a habit that has tripped him up time and again: making the debate about himself and his controversial views.
‘‘I will look at it at the time,’’ he said in a response to a question from moderator Chris Wallace about whether he would accept the results of the election, echoing his unsubstantiated claims on the campaign trail of a ‘‘rigged’’ contest.
Later the Republican nominee added: ‘‘I will tell you at the time. I will keep you in suspense.’’
The real estate businessman and reality TV star long billed himself as the ideal messenger to prosecute a devastating case against Clinton before tens of millions of onlookers, a political outsider with a knack for piercing insults who could sow serious doubts about her character.
Instead, during nearly 300 minutes spent debating Clinton over the past month, Trump repeatedly missed chances to communicate a clear case against her. Instead, he mostly shone a spotlight on his own weaknesses and stumbled through a series of unforced errors — feeding concerns about his treatment of women, his readiness for the presidency, and his temperament for the job.
For Trump, the debates have been at the center of the most destructive two-month period of his campaign, when he has faced multiple accusations of unwanted sexual advances against women and blowback over his vulgar comments on a hot microphone about forcing himself on women sexually.
He now trails Clinton by a wide margin in nearly all national and battleground state polls, and party leaders fear it is too late for him to recover.
For the GOP, the debates have amounted to an enormous missed opportunity to mount its case against Clinton, which has been years in the making and which many Republicans were once confident would be their key to victory. The Republican nominee struggled throughout the debates to keep a consistent focus on Clinton rather than himself.
At times Wednesday night, Trump showed flashes of the debater many Republican leaders have been eager to see emerge.
He landed a blow against her shift on trade and raised a recently revealed video showing a Democratic operative bragging about disrupting Trump rallies.
But for the most part, Trump was repeatedly on the defensive on issues that have dogged him throughout the year.
Toward the end of the debate, Trump, who desperately needs to improve his image among female voters, attacked Clinton in a way that could further complicate the task.
‘‘Such a nasty woman,’’ the nominee said with disdain in his voice.