The National Cyber Security Centre (NCSC) has "significant investigative leads" into recent attacks which have hit computer systems in the UK, the organisation's chief executive Ciaran Martin said.
Mr Martin said the UK authorities were working to make the country the "hardest target we can be" for criminals or state-backed hackers, but "significant attacks" had to be expected.
The NCSC believes the cyber attack that struck businesses around the world earlier this week was designed to disrupt, rather than earn money.
Mr Martin warned: "In a free and prosperous society, people will always seek to steal, spy and disrupt, and the digital world allows new means of doing that at a larger scale."
He told BBC Radio 4's Today programme it was important to apply basic protections, such as updating software, installing anti-virus protection and backing up data, because "we don't want to see cybergeddon".
He said: "What we are living through is a period where we can expect significant attacks - we have seen significant attacks - but what we are learning is most of those significant attacks exploit basic weaknesses and we need to fix those basic weaknesses as individuals, as businesses and as government. "
If the recent attack was intended to disrupt, by deleting data or shutting down systems, it raises the prospect of a foreign state, rather than criminals in search of money, being behind it.
Asked if that was the case, Mr Martin said: "In all the major recent cases, we have got significant investigative leads and I'm not really able to say what they are at this point, working closely with law enforcement and so on.
"Attacks from other countries can happen for a variety of reasons. Some of them can be economic, other countries will want to steal valuable commercial secrets.
"Some of them will be for espionage purposes, some of them will be for potentially disruptive purposes.
"There are a number of things we can do and are doing. When we are building new, critical systems we try to build in really clever resilience so that the system can only be disrupted to a limited extent."
The latest global attack comes after Parliament's systems were targeted at the weekend and the NHS suffered widespread disruption after being caught up in an international WannaCry ransomware incident in May.
Defence Secretary Sir Michael Fallon has warned that hackers could face a response from "any domain", including military action or a retaliatory cyber strike.
Mr Martin confirmed the UK was building up a "significant" capability.
"We are building up a significant response capability so that we can defend the national interest as and when we need to," he said.
"We will do absolutely everything in our power to build up national defences to make us the hardest target we can be."