WASHINGTON — The Obama administration feared that acknowledging Russian meddling in the 2016 election would reveal too much about intelligence gathering and be interpreted as “taking sides” in the race, the former secretary of homeland security said Wednesday.

“One of the candidates, as you recall, was predicting that the election was going to be ‘rigged’ in some way,” said Jeh Johnson, the former secretary, referring to President Trump’s unsubstantiated accusation before Election Day. “We were concerned that by making the statement we might, in and of itself, be challenging the integrity of the election process itself.”

Mr. Johnson’s testimony, before the House Intelligence Committee, provided a fresh insight into how the Obama administration tried to balance politically explosive information with the public’s need to know. That question also vexed federal law enforcement officials investigating Hillary Clinton’s use of a private email server.

The Run-Up

The podcast that makes sense of the most delirious stretch of the 2016 campaign.

Mr. Johnson said he became increasingly concerned about the vulnerabilities of the nation’s election infrastructure, particularly after the hacking at the Democratic National Committee last summer. The administration formally accused the Russian government of hacking into emails from the D.N.C. and other institutions and individuals on Oct. 7

He said he considered having elections systems designated as “critical infrastructure,” a classification that would allow for the same cybersecurity protections available to the financial services and transportation sectors.

But the reactions to that idea, at least from several state election officials who control elections, “ranged from neutral to negative,” Mr. Johnson said.

Around mid-August, Mr. Johnson said, federal officials began hearing reports of “scanning and probing” of some state voter database registries. In the weeks after, intelligence officials became convinced the Russians were behind those efforts, though he said it was not until January that they were “in a position to say” that.

The administration formally accused the Russian government on Oct. 7, when Mr. Johnson and James R. Clapper Jr., then the director of national intelligence, released a statement saying the Russians had leaked information “intended to interfere with the U.S. election process.”

That was not soon enough for some Democrats, who have criticized the Obama administration for waiting until a month before the election to reveal its concern. Representative Adam B. Schiff of California, the committee’s senior Democrat, pressed Mr. Johnson to explain their rationale.

“Why wasn’t it more important to tell the American people the length and breadth of what the Russians were doing to interfere in an election than any risk that it might be seen as putting your hand on the scale?” Mr. Schiff asked. “Didn’t the public have a compelling need to know?”

Asked why former President Barack Obama did not make his own announcement that a foreign power was meddling in the election process, Mr. Johnson suggested administration officials believed just his involvement would inherently politicize the facts.

“We were very concerned that we not be perceived as taking sides in the election, injecting ourselves into a very heated campaign or taking steps to delegitimize the election process and undermine the integrity of the election process,” he said.

Noting that the hacking happened “at the direction of Vladimir Putin himself,” Mr. Johnson said he was moved to try to shield the nation’s election system by the “unprecedented” nature of Russian interference in the last election.

“What I mean is that we not only saw infiltrations, but we saw efforts to dump information into the public space for the purpose of influencing the ongoing campaign,” he said, referring to the disclosure of hacked emails.

Republicans also seized on the statement in January by James B. Comey, the former F.B.I. director, that the D.N.C. refused to turn over its servers to investigators after it was discovered that the servers had been hacked.

Representative Trey Gowdy of South Carolina, a Republican who is helping to lead the committee’s investigation into Russian interference, asked Mr. Johnson why a victim — in this case, the D.N.C. — would not turn over evidence of a crime.

“If they had turned the server over to you or Director Comey, maybe we would have known more,” Mr. Gowdy said.

“I’m not going to argue with you, sir,” Mr. Johnson said. “That was a leading question, and I’ll agree to be led.”

Lawmakers were focusing largely on an issue they agreed presented a profound problem for the country: foreign interference in the nation’s democratic process and its pernicious effect on voter confidence.

“Whether our guy won or next time your guy wins,” said Representative Tom Rooney, Republican of Florida, if interference persists “then we really do cease being the country that we are.”