Former Department of Homeland Security Secretary Jeh Johnson said Wednesday the Democratic National Committee decided it didn't need the department's help when it was hacked by the Russians and instead opted to rely on a private cybersecurity firm.

"This was a question I asked repeatedly when I learned of [the hacking]—what are we doing? Are we in there? Are we helping them discover the vulnerabilities, because this was fresh off the OPM experience and there was a point at which DHS cybersecurity experts did get in to OPM and help them discover the bad actors and patch some of the exfiltrations, or at least minimize some of the damage," Johnson said referencing the hack at the Office of Personnel Management.

"I was anxious to know whether our folks were in there, and the response I got was the FBI had spoken to them. They don't want our help. They have CrowdStrike," he said. "That was the answer I got after I asked the question a number of times over the progression of time."

Johnson said he was "not pleased" by the response from the DNC, but said the Department of Homeland Security was limited in its response to the party committee since the department doesn't have the power to patch vulnerabilities over the DNC's objections.

"My interest in helping them was definitely of nonpartisan interest," he said, "and I recall very clearly that I was not pleased that we were not in there helping them patch this vulnerability."

Johnson, who served as secretary of Homeland Security in the Obama administration, said in hindsight he "should've camped out" in front of the DNC's headquarters in Washington, D.C., after the committee refused the department's assistance.

The former secretary was testifying before the House Intelligence Committee as part of its investigation into Russia's interference in the 2016 election.

The intelligence community believes Russia hacked into the DNC and other entities as part of its attempts to influence the election.