A police firearms officer who shot a man in the chest as he opened the door of his flat said the victim was pointing a gun directly at a colleague.
The Met Police officer, who can only be named as M27 for legal reasons, was giving evidence from behind a curtain at the inquest of James Fox, 43.
M27 along with another officer, who can only be identified as D29, were among the armed response team sent to Mr Fox's sixth-floor home in Enfield, north London, in August last year after a report that he had earlier pointed a gun at a child's head.
Mr Fox, who had a history of mental illness and was deemed by police as "emotionally or mentally distressed" (EMD), was hit five times by armed officers who believed he was carrying a gun, North London Coroner's Court heard.
M27 told the jury: "I honestly believe that Mr Fox was about to shoot my colleague. I had already shouted 'armed police'.
"He was pointing the weapon at my colleague. I feared for D29's life but I also feared for my own life."
The officer, who was carrying a ballistic shield, recalled that the corridor leading to the flat was "very silent" and of hearing the sound of a rattling key in the door.
M27 said the door "opened immediately" and Mr Fox had "a gun in his hand and was pointing it at D29".
An air pistol was found when the flat was searched.
M27 told the court: "He did not say anything and at that point I immediately fired a shot at Mr Fox. I thought that D29's life was at imminent risk. The weapon was pointed directly at D29."
The impact of M27's shot to Mr Fox's chest sent him backwards. M27 fired twice but only recalls pulling the trigger once, the officer told the jury.
After Mr Fox fell, M27 said it took "a second" to realise that the police might need to "push in to the premises" to give first aid.
M27 recalled shouting "armed police, if anyone is in there show yourselves" and ensured no-one was in the living room.
M27 said the shot to the chest was meant "to stop" Mr Fox and that a Taser could not have been used in that situation because the shock might have caused him to squeeze the trigger.
Andover-born Mr Fox died at the scene.
Under cross-examination from Owen Greenhall, representing the Fox family, it was suggested that M27 had been laughing and joking during the briefing from a tactical firearms officer before the shooting.
The briefing was used to tell the police team what they could expect as they began the operation armed with lethal weapons.
M27 insisted they had been professional.
The spyhole on Mr Fox's door was blocked by D29.
After showing M27 police footage of the moments before the shooting, Mr Greenhall said: "You accept you raised your pistol, that your pistol is barely a foot away from the door. You accept that no warning has been given about police being present."
M27 replied: "After watching the video, yes."
Mr Greenhall continued: " So if he (Mr Fox) had heard a noise which had caused him to open the door, the first thing he would have seen would be a gun right in his face."
M27 responded: " Yes."
Coroner Andrew Walker had warned the jury that the police video involved "shouting and images moving quickly".
The brief clip showed officers going upstairs at the block of flats and heading to the front door.
There is the sound of gunfire and the words "shots fired, man down, head shot" can be heard.
The jurors had already been told that two hours earlier, Mr Fox had gone to the north London home of his father Eamon Fox and stepmother Mary Bourke. He made threats against the older man, who was not at home.
They have also heard a 101 call to police in which a child, who was in the house with Mrs Bourke but cannot be identified for legal reasons, said: "He had the gun and he was pointing it at me. He was pointing it at my head."
The police had decided that armed containment and an attempt to "call out" to Mr Fox by contacting him by telephone was the best option to try and tackle the situation.
The briefing officer tells the police team: "The intention is to arrest him but also to deal with his EMD".
The jury also heard that Mr Fox, who had previously been sectioned under the Mental Health Act, had been known to own an airgun to "shoot pigeons".
Officers had been told by an informant that Mr Fox was carrying an airgun and did not know anyone with access to a more deadly firearm.
M27 is still giving evidence. The hearing was adjourned until 10am tomorrow.