KYIV/MOSCOW - Ukraine was hit by a cyberattack splashing a warning across government websites to "be afraid and expect the worst," while Russia, which has massed 100,000 troops on its neighbor's frontier, released pictures of more of its forces on the move.

The cyber attack unfolded hours after talks wrapped up with no breakthrough between Russia and Western allies, which fear Moscow could launch a new military assault on a country it invaded in 2014.

"The drumbeat of war is sounding loud," Michael Carpenter, U.S. Ambassador to the Organization for Security and Cooperation in Europe (OSCE), said at the close of talks on Thursday.

Russia denies plans to attack Ukraine but says it could take unspecified military action unless its demands are met, including a promise by the NATO alliance never to admit Kyiv.

Foreign Minister Sergei Lavrov said on Friday that Russia hoped security talks with the United States would resume but that this would depend on Washington's response to Moscow's proposals.

"We categorically will not accept the appearance of NATO right on our borders, especially so given the current course of the Ukrainian leadership," he said.

Asked what Moscow meant by threatening this week to take "military-technical action" if talks fail, Lavrov said: "Measures to deploy military hardware, that is obvious. When we take decisions with military hardware we understand what we mean and what we are preparing for."

Russian Defence Ministry footage released by RIA news agency showed armored vehicles and other military hardware being loaded onto trains in Russia's far east, in what Moscow called an inspection drill to practice long-range deployments.

"This is likely cover for the units being moved towards Ukraine," said Rob Lee, a military analyst and a fellow at the U.S.-based Foreign Policy Research Institute.

"EXPECT THE WORST"

Ukrainian officials were investigating the huge cyberattack, which they said hit around 70 internet sites of government bodies including the ministry of foreign affairs, cabinet of ministers, and security and defense council.

Though they avoided directly accusing Moscow, they made clear they suspected Russia. Russia did not comment but has previously denied being behind cyber attacks, including against Ukraine.

"Ukrainian! All your personal data was uploaded to the public network. All data on the computer is destroyed, it is impossible to restore it," said a message visible on hacked government websites, written in Ukrainian, Russian and Polish.

"All information about you has become public, be afraid and expect the worst. This is for your past, present and future."

NATO responded by announcing that it would sign a new agreement within days with Kyiv on closer cooperation in cyber defense, including giving Ukraine access to the Western military alliance's system for sharing information on malicious software.

Secretary-General Jens Stoltenberg said in a statement that NATO cyber experts were already working with the Ukrainian authorities to respond to the attack, both remotely from Brussels headquarters and on the ground in Ukraine.

Ukraine's foreign ministry spokesperson told Reuters it was too early to say who could be behind the attack but Russia had been behind similar strikes in the past.

The Ukrainian government said it had restored most of the affected sites and no personal data had been stolen.

Ukraine's military intelligence also accused Moscow of preparing "provocations" against Russian troops based in a breakaway region of neighboring Moldova, which could be used as a pretext to invade Ukraine on a new front to the west.

The European Union's top diplomat, Josep Borrell, condemned the cyber attack and said the EU's political and security committee and cyber units would meet to see how to help Kyiv: "I can't blame anybody as I have no proof, but we can imagine."

The message left by the cyberattack was peppered with references that echoed long-running Russian state allegations, rejected by Kyiv, that Ukraine is in the thrall of far-right nationalist groups. It also referred to the sites of killings carried out in Nazi German-occupied Poland by Ukrainian insurgents, a point of contention between Poland and Ukraine.

(Additional reporting by Matthias Williams in Kyiv, Anton Kolodyazhnyy, Tom Balmforth and Andrew Osborn in Moscow, Sabine Siebold and John Irish in Brest, France; Writing by Mark Trevelyan and Peter Graff; Editing by Alison Williams and Hugh Lawson)