Police say that Jake Davison, who shot himself after the attack in Plymouth, was a licensed firearms holder.
There are two main categories - firearms and shotguns.
A firearm is defined in the Firearms Act 1968 as any weapon "from which a shot, bullet or other missile... can be discharged".
A shotgun is a type of gun intended to fire a large number of small pellets rather than a single lead bullet or slug.
It is more difficult to get a licence for firearms than for shotguns, because weapons that fire bullets must only be used for specific purposes in specific places. These would include deer stalking or sports shooting on an approved range.
In contrast, shotguns tend to be used in more general rural circumstances, such as by farmers who are protecting livestock from foxes - and police recognise that landowners need guns for pest control.
According to the most recent figures for England and Wales, there are 156,033 people certificated to hold firearms and they own 617,171 weapons. There are shotgun certificates which cover 1.4 million shotguns.
Statistics for Scotland show that 70,839 firearms were held by 25,983 certificate holders in 2020. 46,703 people in Scotland are certificated to hold shotguns - and 133,037 weapons are covered by that scheme.
Gun laws in the UK are among the toughest in the world.
The police are in charge of issuing shotgun and firearm certificates in England, Scotland and Wales.
Local forces administer the system rather than a central body, because they will have local information that will inform their judgement.
A decision on whether someone gets a licence is the responsibility of the chief officer in that area.
Getting a licence is a long and complicated business.
It starts with an application form which asks specific questions about why the individual wants a gun, telling them they need to show "good reason".
This might be that they need it for their profession or sport. A simple wish to own a particular type of firearm is not in itself enough.
They must also prove that they are allowed to have a firearms certificate and pose no danger to public safety or to the peace.
Independent referees have to provide confidential character statements in which they are expected to answer in detail about the applicant's mental state, home life and attitude towards guns.
Officers check the Police National Computer for a criminal record - anyone who has served a prison sentence of more than three years is banned for life from holding a firearms licence.
The police will also speak to the applicant's GP for evidence of alcoholism, drug abuse or signs of personality disorder. Social services can also be asked for reasons to turn down an applicant.
Finally, senior officers must be sure that prospective shotgun holders have a secure location for the weapon, typically a dedicated gun cabinet. Each certificate is valid for five years.
Chief police officers have the right to revoke a licence or not to renew it.
Police chiefs can revoke certificates if they conclude that the holder can no longer be trusted:
* In 2020/21, 306 firearm certificates were revoked in England and Wales
* In 2019/20, 49 firearms certificates were revoked in Scotland
Failure to use the firearm or failure to acquire one by the end of the certificate's life could also lead to a licence not being renewed.
The two most important laws on gun control in the UK came in the wake of two national tragedies.
Michael Ryan's massacre of 16 people in Hungerford in 1987 led to the banning of all modern semi-automatic rifles, the type of guns that can be fired rapidly without needing to be reloaded.
Nine years later, Thomas Hamilton killed 16 schoolchildren and their teacher when he opened fire at a school in Dunblane. Parliament banned all handguns and there is now a mandatory five-year jail sentence for possession.
The Small Arms Survey estimated there were 978,000 unregistered firearms in England, Scotland and Wales in 2018, and 53,000 in Northern Ireland.
Mass shootings are extremely rare in the UK. Before this year, there had been four in modern times - the last one was in Cumbria in 2010, when a gunman killed 12 people.
Meanwhile, in 2019 alone, there were 417 shootings in the US where at least four people were shot.
People in Northern Ireland can hold firearms certificates for activities including sporting and pest control. In 2020, there were 55,441 firearm certificate holders.
Unlike in the rest of the UK, handguns are not banned in Northern Ireland.
Northern Ireland is the only part of the UK where you can own a gun for self-defence. People can apply for a "personal protection weapon" certificate.
These are granted if a person is seen to be at "real and immediate risk" and a gun is seen as "reasonable, proportionate and necessary to protect the life of the applicant".