An attempt to stop prosecutors using messages from hundreds of phones that were part of the Encrochat secret communications network in court has been rejected by the Appeal Court.
Judges ruled the messages, obtained by French police by hacking the phones, were not gained by "interception".
Under British law, evidence from interception cannot be used in court.
The National Crime Agency believes Encrochat was mainly used by criminals, often to trade drugs and guns.
The judgement will have major implications for cases against suspected organised criminals around the country.
Due to legal restrictions, it is the first time the BBC can report the detail of arguments surrounding Encrochat, which was penetrated by police last summer resulting in more than 1,000 arrests.
The NCA, which obtained the evidence from France, said it was the biggest breakthrough ever in the fight against organised crime.
Senior officers described it "as akin to cracking the enigma code".
The messages, sent by suspects who did not know they were being monitored, detail alleged drug dealing and murder plots, and include images and videos.
Many of the cases based on "Encro" evidence are now going to court, and if this judgement had ruled the messages couldn't be used, some trials may have been abandoned.
Under long-standing British law, designed to protect intelligence techniques from scrutiny and make criminal trials manageable, intercepted evidence can't be used in court.
In a 2015 factsheet on the bill before it became law, the Home Office defined interception as "making available the content of a communication to someone other than the sender or intended recipient during the course of its transmission. In practice that means listening to a phone call or reading an email".
But the Lord Chief Justice, Lord Burnett of Maldon, Lord Justice Edis, and Mrs Justice Whipple dismissed an appeal by lawyers for Encrochat defendants.
The key legal argument centred on a piece of "malware" placed by French experts on Encrochat phones worldwide. It sent copies of every message to a police server.
France has refused to say how, what it called "the implant", worked, creating legal uncertainty in British courts.
Encrochat was a private messaging service that promised its users secure and secretive communications.
As well as the Encrochat messaging app, the company developed a modified version of the Android operating system and sold altered smartphones known as "carbon units" to run its software.
Switched on by pressing just the power button, the phones would load a "dummy" Android homescreen.
But activated another way they would boot into Encrochat mode.
Getting hold of an Encrochat phone was not cheap, and the subscription charges were more than £200 a month.
Messages sent between handsets were end-to-end encrypted: scrambled as they travelled across the internet, making them practically impossible to decode if intercepted.
But in June 2020, the company warned its users that an attack had comprised its handsets and advised them to "physically dispose of your device immediately".
If the implant had collected the messages as they were being transmitted, this would amount to interception of the communications.
The defence lawyers claimed the implant was taking messages from the phones' memory, milliseconds before being sent to their wifi or mobile data transmitters and therefore the data was "in transmission".
But the judges decided the data was in fact being stored temporarily on the devices as it was processed, before being transmitted.
They said this was evident because during the actual transmission the message were encrypted, and therefore couldn't have been read, as they were by the police.
The data collected also included crucial username information from the phone's storage memory, which is not sent as part of the transmission.
In Friday's judgement they compared the process with that of sending a letter: "The process involves the letter being written, put in an envelope, a stamp being attached and then the letter being placed in the post box.
"Only the last act involves the letter being transmitted by a system, but all the acts are essential to that transmission."
Families of those arrested during the fall-out from the Encrochat penetration have been arguing online that the NCA broke the law by accessing and reading messages "in real time", as they were being sent.
They say British law enforcement agencies effectively allowed a foreign power, France, to hack the phones of 9,000 UK Encrochat users.
Police claimed that in general, using an Encrochat phone, which cost thousands of pounds to own and operate, demonstrated a likely involvement in criminal activity.
But suspects' supporters say innocent family members were caught up in a race to make use of the Encro messages, because police feared they would be criticised if they were not seen to take action.
However the decision of the Appeal Court was that the evidence was collected lawfully.