The RAF could carry out air strikes in response to cyber attacks aimed at Britain, Defence Secretary Sir Michael Fallon warned potential hackers.
Speaking in the wake of a "sustained and determined" assault on the parliamentary network, Sir Michael said the UK had the ability to respond to online attacks "from any domain - air, land, sea or cyber".
The Defence Secretary highlighted the success of the UK's ability to carry out cyber attacks against so-called Islamic State (IS) in Iraq and Syria and offered similar British support to future Nato operations.
Sir Michael said the UK was investing in "full spectrum capabilities" - ranging from the new aircraft carriers to offensive online capabilities. This was "signalling to potential cyber strikers that the price of an online attack could invite a response from any domain - air, land, sea or cyberspace".
"When it comes to the latter, we are making sure that offensive cyber is an integral part of our arsenal," he said. "We now have the skills to expose cyber criminals, to hunt them down and to prosecute them. To respond in kind to any assault at a time of our choosing."
In a speech at the Chatham House foreign affairs think tank, Sir Michael said: "Last Friday we saw the UK hit by yet another cyber attack, this time directed against our parliamentary IT systems.
"Investigations so far have found that the hackers were attempting to carry out a sustained and determined attack on all parliamentary user accounts in an attempt to identify weak passwords to gain access to users' emails."
Asked about the sort of action that could be taken against the hackers behind the attack on parliament, Sir Michael said where perpetrators can be identified then "as far as we can" they should be prosecuted.
"We have no evidence yet as to who was behind the attack on Parliament, it is too early to speculate what kind of actor was involved," he said.
"When we know, we have got to consider how to respond."
The Defence Secretary said the UK's ability to carry out its own cyber attacks against IS, also known as Daesh, had helped save lives during the battle for Mosul in Iraq and the capability was also being used in the fight for Raqqa in Syria.
Sir Michael said: "Having honed our own UK pioneering cyber techniques against Daesh in Iraq and Syria, I can confirm today that the UK is ready to become one of the first Nato members to publicly offer such support to Nato operations as and when required."
Sir Michael stressed the need for all Britons to step up efforts to protect themselves against cyber attack.
"We all have a responsibility to look after ourselves online," he said.
"A stronger password here, a Windows update there and we would have stood an even better chance of warding off the parliamentary and WannaCry attacks."
The Ministry of Defence had a "key role to play in contributing to a culture of resilience", he said.
Asked if people should be aware that when they went online they were operating in a "hostile environment" he said: "Yes, I do. All of us, in our business, our organisations, our personal security need to be much more aware that it is not the system itself, it is the way in which the system is accessed at which there are points of vulnerability.
"I'm sure there will be many of us who will be thinking of those early and rather easy passwords we adopted going into our own accounts. We all have a responsibility to be much more conscious now of the scale of these attacks and the ease with which some of these hacktivists are getting through.
"So we all have to be vigilant."