Iran said on Tuesday it had foiled a cyber-attack on the Islamic republic’s oil ministry, and that those behind the hacking attempt were based in the United States.

The Fars news agency cited Brigadier General Kamal Hadianfar, head of the cyber police, as saying the unit had thwarted "the hackers’ attack on the oil ministry".

He said the source of the attempt was in the United States, and that the US authorities had been informed.

"The IP address for these hackers was in America," he said, adding that "an international judicial order" had been sent to the United States, without elaborating.

Hadianfar said the hacking attempt took place over a four-day period at the start of the new Iranian year which began on March 20.

Iran’s controversial nuclear programme was the target of a 2010 cyber-attack by the Stuxnet virus, in a hack Tehran blamed on both the United States and Israel.

A February report by Russian security firm Kaspersky Lab spoke of a powerful cyber-spying tool that can tap into millions of computers worldwide through secretly installed malware, with many signs pointing to a US-led effort.

Iran has also been accused of developing its own cyber espionage capability.

US National Intelligence Director James Clapper in February blamed Iran for a cyber attack on Sands Casino in Las Vegas that stole confidential data and shut down many of the casino’s operations.

The assault came after the billionaire owner of Sands, Sheldon Adelson, said in 2013 that "Iran should be nuked".

And last December, US cyber-security firm Cylance said Iran-based hackers had been engaged for two years in an operation dubbed "Cleaver".

Cylance researchers said the effort has "conducted a significant global surveillance and infiltration campaign".

They said targets include government networks as well as companies involved in military, oil and gas, energy and utilities, transportation, airlines, airports, hospitals, telecommunications, technology, education, aerospace and other sectors.

The report said the campaign appeared to be retaliation for the Stuxnet virus.