U.S. intelligence agencies have concluded that the Kremlin orchestrated a wide-ranging influence operation that included email hacking and online propaganda to discredit Democratic presidential candidate Hillary Clinton and help Trump, a Republican, win the White House in November.
The Russia issue has cast a shadow over President Trump's first five months in office.
Jeh Johnson, who led the Homeland Security Department until the end of the Obama administration, said his department had issued warnings about hacking into voter registration databases.
But he told the U.S. House Intelligence Committee, which is investigating alleged Russian meddling in the election, that the notices did not get the attention he would have liked, blaming the emergence of a 2005 tape - in which Trump brags about sexually assaulting women - for distracting the American public.
The extent of interference by Russian hackers has been the source of speculation and media reports for months.
Jeanette Manfra, the Homeland Security Department's acting deputy undersecretary of cyber security, disclosed publicly for the first time that a total of 21 states were targeted and said a small number of those systems were breached, although she reiterated there was no evidence any votes were manipulated.
"As of right now, we have evidence that election-related systems in 21 states were targeted," Manfra told the Senate Intelligence Committee in a separate hearing on Wednesday.
Asked why the Obama administration did not do more to warn the public, Johnson said: "We were very concerned that we would not be perceived as taking sides in the election, injecting ourselves into a very heated campaign."
Mark Warner, the top Democrat on the Senate panel, expressed frustration at Manfra's refusal to identify which states had been targeted. Arizona and Illinois last year confirmed that hackers had targeted their voter registration systems.
Samuel Liles, another senior DHS cyber official, likened states targeted or scanned to a thief walking by homes to scout for weaknesses, and breaches to breaking through a front door.
Special Counsel Robert Mueller, a former FBI director, met on Wednesday with senior Senate Judiciary Committee members to ensure there was no conflict between his investigation of potential collusion between Russia and the Trump campaign and the panel's probe of what led to Trump firing Federal Bureau of Investigation Director James Comey.
Trump acknowledged on Friday he was under investigation in the probe of alleged Russian meddling in the 2016 race and possible collusion by his campaign, and seemed to assail the Justice Department official overseeing the inquiry.
Mueller was examining whether Trump or others sought to obstruct the probe, a person familiar with the inquiry told Reuters.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)