The smuggling operation bringing cocaine and cannabis, hidden inside items of machinery, into the UK was uncovered following an investigation by the National Crime Agency (NCA), Ipswich Crown Court heard.
Irish police seized documents identifying a UK-based freight transport company in January 2017, while making a number of arrests in Dublin in which they seized "a significant quantity of firearms and class A drugs", the court heard.
The NCA began an investigation and in October 2017 customs officials at Dover seized a consignment of 15kg of cocaine and 200kg of cannabis hidden inside two large Tarmac removal machines, said Riel Karmy-Jones QC, prosecuting.
She said the estimated street value of the cocaine was £1.2 million, and £2 million for the cannabis.
One of the machines also had a GPS tracking device inside.
"The investigation by the NCA uncovered that drugs were being imported into the UK from mainland Europe concealed within items of machinery and delivered by legitimate transportation and logistics companies," Ms Karmy-Jones said.
"Once at their destination in the UK, the drugs would be removed, and the machinery reloaded with cash, which in turn was carried back to mainland Europe in payment for the drugs."
Inquiries led officers to an industrial unit in Wednesbury in the West Midlands which they searched the following day, discovering a large transformer which had been adapted for internal concealment, the barrister said.
Hidden inside was a Smith and Wesson 357 revolver gun and 85 rounds of ammunition inside a large black holdall.
Further searches at other addresses led to the seizure of encrypted Blackberry phones, and communications on the devices were analysed.
She said that analysis of the communications identified a further 22 importations.
Ms Karmy-Jones said that, from the communications, it is estimated cocaine with a street value of more than £23 million and cannabis with a street value of £6 million to £8 million in total was imported.
Thomas Kavanagh, 54, of Tamworth, Staffordshire, was referred to in the encrypted communications as "the gaffer", Ms Karmy-Jones said.
She said that Kavanagh "sits at the head of the organisation".
He lived in a gated home with "significant security alterations" including bulletproof glass, and weapons were found there including knives, Ms Karmy-Jones said.
She said that Gary Vickery, 39, of Solihull, was "immediately beneath" Kavanagh and 43-year-old Daniel Canning, who is Vickery's brother-in-law and also has an address in Solihull, was "subordinate to Vickery".
All three defendants admitted at an earlier hearing to conspiring to import class A and B drugs, and money laundering.
Canning also admitted possessing a firearm and ammunition.
"The prosecution case as to the extent of the conspiracies to import cocaine and cannabis relies heavily on inferences to be drawn in respect of the additional 22 importations," Ms Karmy-Jones said.
She continued: "This was a highly sophisticated operation, involving an enormous commercial quantity of cocaine and cannabis, crossing a number of geographical borders, to be bought and sold for substantial gain."
Vickery and Canning have no previous convictions, the court heard.
Kavanagh has 16 previous convictions dating back to 1985 including convictions in Ireland for burglary, possessing firearms and ammunition without a certificate, and assault occasioning actual bodily harm.
His most recent conviction in the UK was in September 2019 for possession of a disguised firearm, a stun gun, discovered during a search of his home address.
He received a three-year jail-term for this.
Kieran Vaughan QC, for Kavanagh, said "there are others not before the court who are above" Kavanagh.
He added that Kavanagh has six children and two grandchildren.
Richard Furlong, for Canning, said Canning was a father-of-three who had worked as a mechanic since the age of 15.
The sentencing exercise, which began on Friday, is due to last two days.