The Trump administration on Monday slapped sanctions on​ ​five​ ​Russian companies and three individuals for​ ​helping​ Moscow’s main security ​​agency​ ​launch cyberattacks on the US energy grid​ and infrastructure.

“The entities designated today have directly contributed to improving Russia’s cyber and underwater capabilities through their work with the FSB and therefore jeopardize the safety and security of the United States and our allies,” Treasury Secretary Steven Mnuchin said in a statement, referring to Russia’s Federal Security Service.

The action stems from legislation passed last year and an executive order that aims to target and punish efforts to hack into computer systems in the United States.

The sanctions will freeze any assets the firms and individuals have in US jurisdictions and prohibit Americans from doing business with them.

“The United States is engaged in an ongoing effort to counter malicious actors working at the behest of the Russian Federation and its military and intelligence units to increase Russia’s offensive cyber capabilities,” Mnuchin said.

The Russian hackers were behind attacks on the US energy grid and infrastructure, including water processing systems, that began in March 2016, the Treasury said.

They were responsible for using malware to try to infect servers around the world, including last year’s NotPetya attack that crippled computers in Ukraine as part of an effort to hobble its financial system.

The statement also said Russia has been tracking the locations of undersea cables that carry much of the world’s telecommunications data.

​The sanctions were imposed against Digital Security​, which has offices in Moscow and St. Petersburg, ​as well as its subsidiaries ERPScan and Embedi​; ​Moscow-based Kvant Scientific Research Institute; and ​​Divetechnoservices of St. Petersburg.

T​he three individuals are employees of ​ ​Divetechnoservices — Aleksandr Lvovich Tribun, Oleg Sergeyevich Chirikov and Vladimir Yakovlevich Kaganskiy.

​Digital Security provided technological support to the FSB and Divetechnoservices ​purchased a variety of underwater equipment and diving systems, including a submarine, for Russian government agencies.

The Treasury Department in April imposed sanctions on seven Russian businessmen, their companies and a number of government officials for cyberattacks in Crimea, Syria and Ukraine.

The US also joined with its Western allies to expel a number of Russian diplomats in retaliation for the March poisoning of former Russian spy Sergei Skripal and his daughter in England.

British Prime Minister Theresa May blamed Russia for being behind the poisoning, saying the Kremlin used a military-grade toxin in the attack.

With Wires