Hackers linked to the Iranian government have targeted a U.S presidential campaign, Microsoft said Friday. Sources told Reuters it was President Trump's reelection campaign in the crosshairs.

Hackers targeted 241 accounts in total, including those linked to the presidential campaign, government officials, media figures and prominent Iranian expatriates. Four accounts were penetrated successfully. Sources familiar with the operation told Reuters the Trump campaign was not among those successfully penetrated.

The announcement is the latest alarm that foreign governments may be looking for ways to influence the 2020 election. It comes less than a week after Iran’s foreign minister denied Iran was interfering in the 2020 presidential election, but ominously stated that “there is a cyberwar going on” in an interview with NBC.

IRAN PREPARES FOR CYBERWR AMID RISING TENSIONS, BOASTS THOUSANDS OF CYBER BATTALIONS

“The United States started that cyberwar, with attacking our nuclear facilities in a very dangerous, irresponsible way that could’ve killed millions of people. You remember Stuxnet?” Foreign Minister Javad Zarif told Chuck Todd on “Meet the Press.” “So there is a cyberwar … and Iran is engaged in that cyberwar."

He further declared that "any war that the United States starts, it won’t be able to finish.”

Tensions between the U.S. and Iran have been steadily rising in recent months after President Trump angered that foreign nation’s leadership by pulling out of a 2015 deal intended to curb Iran's nuclear ambitions and ramping up sanctions. Iran could be hoping to usher in a 2020 U.S. president who will look more kindly upon it.

In the 2016 election, Russian government hackers worked to infiltrate U.S. election infrastructure, and may have identified vulnerabilities ripe for exploitation in future elections. Former Special Counsel Robert Mueller warned in July that “many more countries are developing capabilities to replicate” Moscow’s activities.

The latest attacks occurred during a 30-day period between August and September, perpetrated by a group Microsoft calls Phosphorus. Keepers of the four compromised accounts have been notified and the Department of Homeland Security said it was working with Microsoft to “assess and mitigate impacts.”

Microsoft’s Tom Burt said the hackers used password reset and account recovery features to try to take over the accounts. Some 2,700 attempts were made to identify email addresses that belonged to Microsoft customers.

Tim Murtaugh, a spokesman for Trump's 2020 reelection campaign, said Friday there was "no indication that any of our campaign infrastructure was targeted." The campaigns of Sen. Kamala Harris, Michael Bennet and Pete Buttigieg told The Associated Press they had not been targeted either.

On Friday, Fox News learned that the Islamic Republic of Iran has been beefing up its cyberintelligence forces. “Iran has been aggressive over the past several years when it comes to cyberattacks. Its back is against the wall, and it has less to lose from a cyberwar with the United States,” said David Kennedy, founder and CEO of TrustedSec and a onetime military intelligence analyst.

FAKE WEBSITE WITH IRANIAN TIES TARGETS US VETERANS, REPORT SAYS

On Sept. 27 it was announced that hackers thought to be linked to Iran were targeting servicemen and veterans, trying to infiltrate military networks. The hackers ran a fake veterans job site, hoping one of their targets would use a Department of Defense system to download and run the malware, a Homeland Security cybersecurity analyst said.

CLICK HERE FOR THE ALL-NEW FOXBUSINESS.COM

Democrats have put forth several election security bills, including one which would allocate $775 million to enhance election system security, but these have been quashed by the GOP-controlled Senate. Republicans said that money had already been allocated in a previous bill and it was not an immediate need.

The Associated Press contributed to this report.