A man was shot dead as police foiled an attempt to spring two would-be hitmen from a prison van as they made their way to court.
Six other men were arrested after the Scotland Yard operation targeted a car near Wood Green Crown Court in north London, where Izzet Eren, 32, and Erwin Amoyaw-Gyamfi, 29, were later both jailed for 14 years for an attempted "professional hit".
The Independent Police Complaints Commission, which is investigating the fatal incident, said a 28-year-old man died in Bracknell Close, which runs behind the court, after being shot once by a police officer.
Scotland Yard said the operation was not related to terrorism.
There were four police officers inside the packed courtroom, with others stationed inside and outside the building as the two men were sentenced in a delayed hearing on Friday afternoon.
The court heard that Eren and Amoyaw-Gyamfi were arrested by armed police while riding a stolen motorbike in north London on October 13 and found to be carrying a Skorpion sub-machine gun and Tokarev handgun.
The court was told they were intercepted en route to "kill, or maim or wound" an unnamed person and pleaded guilty to charges of possessing guns and ammunition with intent to endanger life, aggravated vehicle-taking and a driving offence at a previous hearing.
They were both on licence for previous crimes when they were arrested, the court heard.
Jailing the men, who have a string of prior drug and violence convictions, Judge Nicholas Browne QC said the gravity of gun crime "could not be overstated".
The judge said: "This was to be a professional hit. Each of you was armed with a loaded, lethal weapon.
"The potential consequences were all too obvious. You could have been killed or seriously injured. So could innocent members of the public, not to mention your intended victim."
He added: "In sentencing you I completely ignore and put out of my mind the serious incident outside the court area, not far from where I am today. I observe and agree with your wish to be sentenced today."
Armed police wearing balaclavas and in unmarked 4x4 vehicles carried out the "intelligence-led" operation near the court at around 9am on Friday.
The Directorate of Professional Standards - the Metropolitan Police's internal watchdog - is investigating, along with the IPCC.
An IPCC spokesman said: "A firearms officer has reported that he discharged his firearm and analysis of the officer's ammunition confirms that a single shot was fired.
"What appears to be a non-police issue firearm was found at the scene and will be subject to ballistic and forensic tests.
"The police officers involved in the operation were specialist firearms officers who are not issued with body-worn video cameras.
"A number of members of the public who witnessed the shooting have been identified and IPCC investigators are in the process of taking their statements."
Scotland Yard said six men aged between 19 and 32 were arrested on suspicion of conspiracy to facilitate escape from lawful custody following the incident.
A 30-year-old and a 19-year-old were held by armed police in the Bracknell Close area, while a 31-year-old and a 25-year-old were detained in nearby Barratt Avenue. They are currently being questioned at separate police stations.
Two other men, aged 29 and 32, were arrested for the same offence later in the afternoon before being bailed.