“And I’m not even talking about nuclear power,” Mr. Trump added.

It was unclear what other “power” Mr. Trump might have been referring to. But the threat was notable in part because Mr. Trump speaks far less often than his two predecessors about the threat of terrorism.

That is largely because foreign-inspired terrorists have not executed an attack within the United States since October 2017 — when an Islamic State sympathizer drove a pickup truck down a bike path in Lower Manhattan, killing eight and injuring 11 — and attacks by Islamic radicals in Europe have abated in recent years.

In place of terrorists inspired by radical visions of Islam, Mr. Trump has presided during a surge in mass shootings by white American men who subscribe to racist and anti-Semitic ideology. Mr. Trump vowed last month that such “sinister ideologies must be defeated,” but has barely reckoned with the charge that his own language may have played a role in their rise.

It was shortly after the Islamic State-inspired shooting in San Bernardino, Calif., which left 16 people dead in December 2015, that Mr. Trump called for a “total and complete shutdown of Muslims entering the United States until our country’s representatives can figure out what the hell is going on.”

After Mr. Trump won several primaries that March, he told supporters that it was the reaction to the California massacre — as well as to the killing of 130 people by the Islamic State in Paris — that had vaulted him ahead of his political rivals.

“Paris happened,” Mr. Trump said. “And then we had a case in Los Angeles,” he added, saying that his “whole run took on a whole new meaning.”

“And all of a sudden,” Mr. Trump said, “the poll numbers just shot up.”

“Trump positioned himself as the toughest candidate on Muslim extremism,” said Alex Conant, an adviser to Senator Marco Rubio of Florida, who also sought the 2016 Republican nomination. “It came to be a contest about who can be the toughest on terrorism. And Trump became the toughest because he said things that nobody else could say.”