Updated

Election officials in 21 states have been notified by the Department of Homeland Security that hackers targeted voter registration systems ahead of last year's presidential election.

In most cases, the systems were not breached. A small number of networks were compromised, but those affected were not involved in the actual tallying of votes. In most of the states, the targeting involved preparatory activity, such as scanning computer systems.

The states targeted are Alabama, Alaska, Arizona, California, Colorado, Connecticut, Delaware, Florida, Illinois, Iowa, Maryland, Minnesota, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Texas, Virginia, Washington and Wisconsin.

In most cases, the states had not known until notified by DHS Friday, though the government had told the Associated Press last year that more than 20 states were targeted by hackers believed to be Russian agents.

The government did not say Friday who was behind the hacking attempts or provide details about what had been sought. But election officials in three states said Friday the attempts could be linked to Russia.

The Wisconsin Election Commission, for example, said the state's systems were targeted by "Russian government cyber actors."

Only Illinois reported that hackers had succeeded in breaching its voter systems.

Other states said their cybersecurity efforts turned back efforts to get to crucial information.

"There are constant attempts by bad actors to hack our systems," Iowa Secretary of State Paul Pate, a Republican, said in a statement. "But we continue to deflect those attempts."

Colorado said the hacking wasn't quite a breach.

"It's really reconnaissance by a bad guy to try and figure out how we would break into your computer," said Trevor Timmons, a spokesman for the Colorado secretary of state's office. "It's not an attack. I wouldn't call it a probe. It's not a breach, it's not a penetration."

The disclosure to the states comes as a special counsel probes whether there was any coordination during the 2016 presidential campaign between Russia and associates of Donald Trump.

"It is completely unacceptable that it has taken DHS over a year to inform our office of Russian scanning of our systems, despite our repeated requests for information," California Secretary of State Alex Padilla, a Democrat, said in a statement. "The practice of withholding critical information from elections officials is a detriment to the security of our elections and our democracy."

U.S. Sen. Mark Warner, D-Va., the vice chairman of the Senate Intelligence Committee -- which is also investigating Russian meddling in last year's election -- has been pushing the department for months to reveal the identities of the targeted states. He said states need such information in real time so they can strengthen their cyber defenses.

"We have to do better in the future," he said.

Homeland Security said it recognizes that state and local officials should be kept informed about cybersecurity risks to election infrastructure.

"We are working with them to refine our processes for sharing this information while protecting the integrity of investigations and the confidentiality of system owners," it said in a statement.

Earlier this year, a leaked National Security Agency report detailed that hackers obtained information from a company that provided software to manage voter registrations in eight states. The May report said hackers sent phishing emails to 122 local election officials just before the November 2016 election in an attempt to break into their systems.

The latest disclosure to the states comes as a special counsel investigates whether there was any coordination during the 2016 presidential campaign between Russia and associates of Donald Trump.

Trump, a Republican who defeated Democrat Hillary Clinton in the presidential election, has called the Russia story a hoax. He says Russian President Vladimir Putin "vehemently denied" the conclusions of numerous American intelligence agencies.

For states that were told they were not targets, the news brought relief.

"This is one time we like being at the bottom of the list," said Lisa Strimple, a spokeswoman for Nebraska's secretary of state.

Fox News' Bill Mears and The Associated Press contributed to this report.