A man has died after he was shot as an eight-hour siege was brought to an end by police in West Yorkshire.
Earlier, an officer had received minor injuries after shots were fired by the man in a house in Kirkheaton, Huddersfield on Monday night. Armed police then surrounded the property.
The gunman, 42, was brought from the house at about 0600 GMT on Tuesday after police returned fire.
He was taken away in an ambulance but died later in hospital.
The siege took place in a terrace of houses just off Cockley Hill Lane, near the centre of Kirkheaton village.
A police cordon remains at both ends of the road.
Senior police officers said the position of the building meant they did not believe other residents in the area were at risk during the siege.
The gunman was believed to be alone.
'Carrying machine guns'
Neighbour Mark Blezzard, 30, said he heard around eight or nine shots as he followed the incident throughout the night.
He said: "The police then just told us to stay inside but I could see what was going on opposite.
"Loads of police turned up - some carrying machine guns.
"They lit the house up like a Christmas tree and the armed police were behind hedges."
Mr Blezzard, who works as an engineer, said he stayed up all night watching what was happening.
He said: "The police were shouting 'drop your weapon - drop your weapon' and all that carry on.
"I reckon there were about eight or nine shots through the night.
"I'm sure I heard one bounce off a wall."
Another resident, Andrew Cousins, said: "At first we thought it was fireworks.
"We didn't know it was actually gunshots.
"We heard the police saying: 'Drop your weapon and come out with your hands up'. That's when we actually realised."
Local rector Richard Steel said he was alerted by parishioners caught behind the cordon who texted him about the arrival of the police.
He said: "It is a great shock because it is a lovely place to live.
"It's a typical quiet place with a solid, traditional village core."
The incident began at about 2200 GMT when police went to arrest a man on suspicion of making threats towards another man at a nearby property earlier in the day.
When he saw the officers he produced a handgun and opened fire, hitting one of them.
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.
A police spokesman said: "The man produced a gun and fired at the officers. A male officer in his 20s was hit and attended hospital for minor injuries."
He added that officers had tried to "resolve the situation peacefully although shots have continually been fired at the officers."
The Independent Police Complaints Commission is investigating the incident.