A policeman who was shot in an incident which sparked a seven-hour siege was saved from serious injury by his body armour, his chief constable has said.
The 29-year-old West Yorkshire Police officer was shot when he went to arrest a 42-year-old man in Kirkheaton, near Huddersfield, on Monday.
After a night-long stand-off with armed officers the man was shot by a police marksman and later died.
The Independent Police Complaints Commission (IPCC) is investigating.
The siege, which resulted in armed police surrounding a property, took place in Cockley Hill Lane, near the centre of Kirkheaton.
West Yorkshire Chief Constable Sir Norman Bettison said officers had gone to the man's property at about 2200 GMT to detain him over allegations of threats made to a family in the village.
He said that after answering the door the man had produced a gun, threatened the officers and told them to leave his premises, which they did.
The chief constable said that as the officers were leaving the property, the man, who he said had a "history of violence", then opened fire.
Speaking during an interview with the Yorkshire Post, Sir Norman said: "The round lodged in the body armour and did not penetrate the final layer, so the officer has severe bruising to the kidney area of his torso and abrasions which were caused by the ricochet of the armour.
"If he hadn't been wearing body armour, it would have undoubtedly caused serious injury in an area where there are a great number of vital organs."
The gunman, who has not yet been named, was brought out of the house at about 0600 GMT on Tuesday after police returned fire.
He was taken away in an ambulance but died later in hospital.
A post-mortem examination was being carried out on Wednesday evening.
West Yorkshire Police said the gunman continued to fire shots but police did not return fire on Monday. They fired back about 0530 GMT on Tuesday.
Neighbours described how large numbers of police arrived in the area on Monday morning, along with a helicopter.
One resident, Andrew Cousins, said he initially thought the gunshots were fireworks, and only realised what was happening when he heard police appealing to the gunman to give himself up.