An inquiry into the UK's largest fishing scandal has uncovered "serious and organised" criminality by Scottish trawlermen and fish processors in an elaborate scam to illegally sell nearly £63m of undeclared fish.

Three large fish factories and 27 skippers have pleaded guilty to sophisticated and lucrative schemes to breach EU fishing quotas, in what one senior police officer described as "industrial level" deception.

They went to extraordinary lengths to conceal their illegally caught fish, installing underground pipelines, secret weighing machines and extra conveyor belts and computers to allow them to land 170,000 tonnes above their EU quota of mackerel and herring between 2002 and 2005.

The extent of the "black landings" scandal emerged as 17 skippers and one of the three factories were given fines totalling nearly £1m at the high court in Glasgow on Friday, after admitting repeated breaches of the Sea Fishing (Enforcement of Community Control Measures) (Scotland) Order 2000. Another six skippers pleaded guilty at the same hearing to landing undeclared fish worth nearly £7m at Lerwick, in the Shetlands, and Peterhead, Aberdeenshire.

Four skippers pleaded guilty in January and a further four in the ring, who can't be named for legal reasons, are still to be prosecuted.

Judge Lord Turnbull, told the 17 skippers sentenced on Friday they were guilty of a "cynical and sophisticated" operation, which brought embarrassment and shameon them and their families. "The motivation was purely financial," he said. "Those who were already making a good living saw this as a way more income could be generated and were prepared to participate in deliberate lies and falsehoods."

Once the illegally caught fish had been sneaked past Government inspectors, it was put on sale in the Lerwick and Peterhead markets, where it was sold to wholesalers and fishmongers as if it had been legally landed, in defiance of strict EU regulations designed to protect Europe's fish stocks from over-fishing.

The Guardian can reveal that the illegally landed fish was sold with the knowledge of the government-funded industry marketing authority Seafish, which took a £2.58 levy for every tonne of over-quota mackerel and herring. That earned it £434,000 in fees before the Scottish Fisheries Protection Agency, now part of Marine Scotland, raided two factories in September 2005.

The headquarters of Seafish in Edinburgh were raided by police and documents seized in 2008, but five months later prosecutors decided not to take any further action. It is thought the Crown Office, the Scottish prosecution body, believed there was no evidence that could lead to the agency being accused of involvement in the scam.

With a series of court cases stretching back to 2010, the scandal has implicated more than half the Scottish mackerel and herring fleet active at that time. It is understood that the true value of the illegal landings linked to the factories involved is closer to £100m, but prosecutors decided to pursue just £63m of landings.

How one Peterhead factory sidestepped the rules. Source: Guardian graphics

Prosecutors have also confiscated £3.1m from 17 skippers who landed catches in Lerwick, and against two of the three firms so far convicted, under proceedings of crime legislation introduced to tackle serious criminal gangs and drugs lords. The largest confiscation order, £425,9000, was against Hamish Slater, the skipper of the trawler Enterprise from Fraserburgh, Aberdeenshire, who admitted landing £3,980,000 worth of undeclared fish. A number of skippers landed fish worth more than £2m.

At Shetland Catch in Lerwick, one of Europe's largest fish processors, the company installed a duplicate conveyor belt when its new factory was built, fitting a secret weight-reading device in the loft and a computer in an engineer's workshop "a considerable distance" from the factory floor.

In its processing plant at Peterhead, north of Aberdeen, Fresh Catch installed an underground pipe to divert fish to secret weighing devices, which used remotely operated pneumatic valves. It built a secret storage room, and operated the clandestine machinery from a hut known to workers as the Wendy House, disguised with fake "Danger: high voltage" signs on its door.

A second factory in the town, Alexander Buchan, which has since closed, fitted a secret scale and conveyor belt, which allowed up to 70% of a boat's catch to go undeclared. It printed a guidance manual showing its staff how to handle undeclared landings, and its staff misled trading standards officers about its purpose.

Detective Superintendent Gordon Gibson, of Grampian police, the senior investigating officer in Operation Trawler, said: "Make no bones about it: it was serious, it was organised and it was criminal. The element of preparation involved was significant, given the methods and means that all these individuals went to.

"Was I surprised? Absolutely. I was surprised at the levels they had gone to disguise their criminal conduct."

An industry source admitted: "This wasn't casual or by accident. It was organised, it was systematic, it was deception. No one disagrees with that."

In a further penalty, which is thought to have cost the convicted skippers millions, the European commission cut the quotas soon after the scandal was reported to Brussels by the UK government in 2005, calling it a "quota payback".

Although none of the trawlermen have been banned from fishing, their quotas were cut by more than 116,000 tonnes of mackerel and nearly 47,000 tonnes of herring over a seven-year period. That payback will end next year.

One source with detailed knowledge of the case said this had damaging consequences for skippers and crews involved, as the market value of mackerel and herring since 2005 had been as much as double the price 10 years ago.

The convictions follow a complex, 10-year investigation involving forensic accountants from KPMG, who analysed the paperwork for thousands of landings, a core team of 25 detectives and support staff from Grampian and Northern police, four British sea fishery officers with Marine Scotland, the Home Office Holmes police computer system, money laundering experts with the Scottish Crime and Drug Enforcement Agency, and specialist prosecutors at the Crown Office.

Operation Trawler has brought to an end a practice which was once endemic in the British fishing industry, but has been made extremely difficult by hi-tech monitoring and tracking of every registered trawler at sea, and much tighter controls on landings at processing firms.

The skippers and firms involved have refused to discuss their convictions; Shetland Catch is still facing confiscation proceedings. But sources with detailed knowledge of the scandal have admitted the practice was widespread within the pelagic fishing industry. Lawyers for one of the convicted men, George Anderson, 55, from Whalsay, Shetland, claimed this year that he evaded the controls because he believed that discarding under-sized fish was "repugnant".

"Black landings" are still common practice across the EU, and prosecutions still take place. In Lerwick and Peterhead, some insist that the undeclared landings, which helped many of the skippers and their crews enjoy comparatively luxurious lifestyles, were well-known within the industry and among regulators.

Asked about its knowledge of the illegal landings, Seafish told the Guardian it was legally required to take the levy, and insisted it had tipped off the authorities to the over-quota landings. However, one source said that the issue was discussed in board meetings, "but the Seafish line was that we weren't a fishery protection agency, our job was to take a levy on every tonne landed."

He added: "They were totally aware they were getting a levy on quota and over-quota fish."

The source denied it was serious and organised crime: the skippers involved paid income tax and business taxes alongside the Seafish levy on all their illegal landings, largely because the over-quota fish was sold in the fish markets as if it were legally declared. Fraud charges were dropped by prosecutors at an early stage, he said.

But he added: "There is nobody defending this. It was morally wrong; it was ecologically wrong and sustainably wrong. There is no excuse.

"A lot of the skippers are saying, 'What we did wasn't right; it was wrong. We really want to draw a line under this and move forward.'"

He said the scandal had the effect of transforming Scotland's pelagic fishing industry into one of the most sustainable in the world: after the raids, the mackerel and herring fleet introduced very strict monitoring and quota management. Since 2008, its fisheries have won a prized Marine Stewardship Council eco-label, and are now the largest in Europe with MSC certification.

But the "black landings" scandal is coming back to haunt the industry. It is expected to lose its MSC accreditation later this year after a bitter dispute with the Faroe Islands and Iceland: both countries have claimed much larger mackerel quotas than is sustainable for the north-east Atlantic stocks, in breach of MSC rules. The Faroese in particular believe the over-quota prosecutions puts the Scottish industry's credibility in severe doubt.

"It's not a proud moment for what is a very proud industry," one senior figure conceded.

Richard Lochhead, the Scottish agriculture secretary, said the convicted were guilty of appalling behaviour. "These illegal activities are a stark and shameful reminder of the culture that existed in some sectors of the fishing industry in past years," he said.

"Thankfully, there has been seismic change in the attitude and behaviour of the fishing fleet, which can only be good thing in securing a viable future for the industry."

Dr Mireille Thom, a senior marine policy officer for the conservation group WWF Scotland, said: "Deliberately ignoring quota rules by landing 'black fish' isn't a victimless offence. Such landings not only undermine the conservation of fish stocks and the fortune of the fleets that fish them, they also distort competition by depressing fish prices. In short, they threaten the public good for the benefit of a few."