Italy's foreign ministry was reportedly hacked last year in a cyberattack that compromised email communications and carried on for more than four months before it was eventually detected.

According to people familiar with the matter, Russia is suspected to be behind the attack that took place last spring, The Guardian reported.

Prime Minister Paolo Gentiloni, who was serving as foreign minister at the time, was not affected in the cyberattack, an Italian government official told the publication, adding that he avoided using email during his tenure.

The official said the malware attack did affect the ministry's "field offices" including embassies and staffers who report to Rome regarding meetings with foreign officials.

However, the hackers did not breach an encrypted system used for classified information. Sensitive information would be protected as well since it was also encrypted, the source said.

"There were no attacks on the encrypted level," the government official said. "So the information - delicate, sensitive information - that is usually shared in this net, which is restricted by code, has never been attacked or part of this attack."

After the attack was detected, the ministry altered its online "architecture" and added new tools to boost its internal security.

While the official did not confirm if Russia was behind the cyberattack, two other people with knowledge of the attack said Moscow was suspected to have been behind it. A source close to the foreign ministry confirmed the same to Reuters as well. The chief prosecutor in Rome is currently investigating the hacking attack.

On Friday, Russian foreign ministry spokeswoman Maria Zakharova responded to Italian news agency ANSA's inquiry regarding the report via WhatsApp saying the claims were baseless.

"There are no facts that prove this assertion," Zakharova said.

Prime Minister Paolo Gentiloni
Italy's foreign ministry was hacked in 2016 with Russia suspected of perpetrating the attack, sources said. Tiziana Fabi/AFP/Getty Images

Earlier this year, US intelligence agencies concluded that President Vladimir Putin ordered a complex, multi-faceted influence campaign designed to undermine American democracy, hurt Democratic candidate Hillary Clinton's campaign and help Donald Trump win the presidency. In October last year, the White House formally accused Russia of orchestrating cyberattacks against the Democratic National Committee and top Democrats in an attempt to interfere in the November election.

The Kremlin dismissed Washington's allegations and slammed the intelligence agencies' report as "baseless and amateurish," saying the claims were "reminiscent of a witch-hunt."

Multiple countries across Europe, including Germany and France, are also bolstering their cyber defences against possible attacks and attempts to disrupt their own upcoming elections.

Officials have also raised serious concerns amid recent disclosures of cyberattacks in Norway, Czech Republic, Ukraine, France, Estonia, Germany, Bulgaria and Austria that investigators believe could have come from Russia in an attempt to undermine faith in democracy and elected officials, influence elections and sow discord.

In November last year, Bulgarian President Rosen Plevneliev warned that "the game in Europe is not to have a full-scale war and to shoot against your enemy, but the game of Mr. Putin is to make other countries dependent."

"What today Russia is trying to achieve is to weaken Europe, to divide Europe and to make us dependent," Plevneliev told the BBC.