A former council leader has told an inquest how he wrestled to the ground a gunman who had shot a Royal Navy officer on board a nuclear-powered submarine.
Lieutenant Commander Ian Molyneux, from Wigan, was killed by Able Seaman Ryan Donovan who went on a rampage onboard HMS Astute while it was docked at Southampton on April 8 2011.
The 23-year-old was jailed for life to serve a minimum of 25 years after pleading guilty at Winchester Crown Court to the murder of Lt Cdr Molyneux.
The navigator yeoman also pleaded guilty to attempting to murder Lieutenant Commander Christopher Hodge, 45, who he shot in the stomach.
The crown court heard that his real targets, who he also admitted to attempting to murder, were Petty Officer Christopher Brown, 36, and Chief Petty Officer David McCoy, 37.
Royston Smith, who was leader of Southampton City Council at the time, was visiting the submarine with other dignitaries and members of the public at the time of the incident.
A school party had just left the submarine when the incident happened, the Southampton inquest heard.
Mr Smith told the inquest how he was in the control room of the submarine when Donovan entered briefly before leaving again.
The 48-year-old said: "Donovan did come in very briefly into the control room but it was very briefly.
"Looking back on it, you might think it was quite unusual as his weapon had a magazine on it which you would never expect on a ship or a submarine."
Mr Smith, who served for 10 years as an RAF aircraft engineer, said he then heard shots from the corridor.
He said: "The first one I thought was an accident, when I heard the second I thought you do not accidentally release two rounds by accident - when that happened I thought something was wrong."
Mr Smith said that Lt Cdr Molyneux then left the control room to see what was happening.
The inquest was played an audio recording from the submarine in which the shots and a shout could be heard.
Mr Smith said he believed the cry was Lt Cdr Molyneux shouting at Donovan.
He said: "There were some shots, Mr Molyneux left the control room, there was that shout, then Donovan came back into the control room."
He continued: "I definitely knew we were in some trouble, my thought processes were that he had a lot of rounds left in that weapon and we do not know what people do when they are unstable and I assumed it would continue until someone stopped him and I was facing him and I felt I had a duty to do that.
"I thought if I can get close to him he can't shoot me, if it's a knife it's a completely different ball game."
Mr Smith said that he suffered bruising to his body and a shoulder injury as he wrestled with Donovan who was holding the SA80 automatic rifle at waist level.
He said: "It wasn't easy, he did resist me.
"As I remember it, another shot was discharged while I was grappling with him to take the gun off him.
"I thought at that time I had been shot which is why I felt it was more important to stop him.
"At that shot, we were in the upright position and swung around to the other side of the control room and then he was on the ground."
The inquest heard that Mr Smith was assisted by the council's chief executive, Alistair Neill, in taking the weapon from Donovan.
The inquest has heard that Lt Cdr Molyneux, 36, suffered a single gunshot wound to the top of his head, six inches above his right earhole, fired from 5cm away.
Home Office pathologist Dr Basil Purdue said that the position in which Lt Cdr Molyneux was found lying face down on the floor was consistent with him rushing forward to tackle the gunman.
A total of seven shots were fired during the incident, the inquest heard.
The crown court sentencing hearing was told that Lt Cdr Molyneux, a father-of-four, known as Molly, had bravely tried to tackle Donovan after hearing previous shots from the SA80.
His widow Gillian, who attended today's hearing, has said previously that nothing could ever replace her soulmate and father of Jamie, Arron, Bethany and Charlie and "the heartbreaking sadness for the loss of Ian".
Donovan had been drinking while ashore and had volunteered for guard duty when onboard, because he admitted he was intent on killing the two petty officers who had reported him for disobeying a direct order to clean a part of the sub.
Donovan had been told he would not be leaving the sub for an attachment on another vessel because of his behaviour, and he had anger towards them, the crown court heard.
The inquest continues.