Foreign Office minister Tariq Ahmad said in a statement on Thursday that the Russian military was responsible for the attack, which initially targeted computers in Ukraine but quickly spread beyond its borders.
The attack -- called NotPetya -- hit companies including British advertising group WPP (, Oreo maker )Mondelez (, U.S. drugmaker )Merck ( and global shipping company )FedEx (. )
"The destructive attack masqueraded as ransomware, but its purpose was principally to disrupt," the U.K. government said in a statement.
"The decision to publicly attribute this incident reiterates the position of the U.K. and its allies that malicious cyber activity will not be tolerated," it added.
The Russian government said it "categorically denied the accusations."
"We think they have no basis and no foundation, and this is nothing else but the continuation of the Russophobic campaign," Dmitry Peskov, a spokesman for President Vladimir Putin, told reporters.
The ransomware infected computers and locked down their hard drives. It would then demand a $300 ransom to be paid in bitcoin.
But even if victims paid, they didn't recover access to their files.
Britain's National Cyber Security Centre, which investigated the attack, said it demonstrated a "high level of planning, research and technical capability."
It said the ransomware was inserted into a legitimate a piece of software used by most of Ukraine's financial and government institutions.
Ahmad said the attack had disrupted organizations across Europe, costing them hundreds of millions of pounds.
Reckitt Benckiser (, the British maker of Lysol, Mucinex and Clearasil, said the attack had a negative effect on its second quarter sales. )
In September, FedEx attributed a $300 million loss to the attack. The company's subsidiary, TNT Express, was forced to suspend business.
Mondelez said shipment delays resulting from the attack caused its second quarter revenue to drop 2.7%.