British security services have lost their legal fight to force an alleged cyber hacker to hand over the passwords to his encrypted computers in a landmark case.

Lauri Love, 31, is fighting attempts to extradite him to America to face criminal charges for breaking into Federal Reserve computers.

He is accused of stealing "massive quantities" of sensitive data resulting in millions of dollars of losses and Mr Love's lawyers say he faces up to 99 years in prison in the US if he is found guilty.

Officers from the National Crime Agency (NCA) launched an investigation and raided his family home in Stradishall, Suffolk, in October 2013 when they seized encrypted computers and hard drives.

No charges were brought in Britain against Love, who studied at Glasgow University, but the NCA wants him to hand over his passwords so officers can check the data before the electronics are returned.

Love's team says the application, if granted, would be a significant blow to privacy and amounts to a "power grab" by the security services.

Delivering her judgment at London's Westminster Magistrates' Court, District Judge Nina Tempia said: "I'm not granting the application because to obtain the information sought the correct procedure to use, as the NCA did two-and-a-half years ago, is RIPA and the inherent safeguards incorporated thereafter."

She said the courts should not use their case management powers to "circumnavigate" existing laws and the safeguards they carry.

Love, the son of a reverend from Suffolk, is suing the NCA for the return of six bits of encrypted hardware being held which he says contain his entire digital life.

But the NCA is fighting the case and applied to the court to force Mr Love to hand over his passwords before it returns the computers.

The NCA argued that screenshots taken of the computers before the encryption kicked in show that Love had information from Nasa, the US military and the Department of Energy.

But the judge agreed with Love's lawyers who argued that the NCA should apply to a court under the controversial Regulation of Investigatory Powers Act (Ripa) to force people to hand over their passwords to decrypt data.

Speaking outside court following the ruling, Love said he is "happy" with the result and accused the NCA of trying to undermine protections safeguarding individuals' property.

He said: "It is a victory, although it is a more an avoidance of disaster.

"It retains the status quo which means there has to be safeguards before you force people to undermine their security."