Michael V. Hayden, the former head of both the CIA and National Security Agency, accused President Trump in an interview that aired Friday of preventing the U.S. from sufficiently safeguarding the 2020 election.

A career intelligence official and retired Air Force general, Mr. Hayden pinned blame on the president while discussing election security during his first interview since suffering from a stroke last November.

“So, you know the 2020 election is upon us right now,” said CNN anchor Don Lemon. “Do you think that we are doing enough so that there won’t be any interference?”

“No, not at all,” Mr. Hayden responded. “Now, people are trying really hard, all right? But the president has to be involved, and the president is not involved.”

The White House did not immediately return a request for comment.

American intelligence agencies have concluded that the Russian government interfered in the 2016 election won by Mr. Trump, and several members of the president’s administration have warned that Moscow is likely to meddle in next year’s race as well.

Russian President Vladimir Putin has denied interfering in the 2016 race, which Mr. Trump repeated Saturday after the leaders met on the sidelines of the Group of 20 summit in Osaka, Japan.

“We talked about it. You know we’ve talked about it before. You know he denies it totally, by the way. How many times can you get somebody to deny something? But he has in the past denied it. He’s denied it also publicly,” Mr. Trump told reporters.

Mr. Hayden, 74, helmed the NSA between 1999 and 2005 under former Presidents Bill Clinton and George W. Bush. He later served as the director of the CIA under Mr. Bush and his successor, former President Barack Obama, before retiring more than a decade ago. He subsequently served as a national security analyst for CNN prior to being sidelined by the stroke last year.