A hacker who blackmailed users of pornography websites in what investigators say is the UK’s most serious cybercrime case has been jailed for six years and five months.

Zain Qaiser targeted millions of computers with malicious browser-locking software that demanded payment of up to $1,000 (£765) to unfreeze screens, Kingston crown court heard.

The 24-year-old, who worked with an international crime group, received more than £500,000 through the multimillion-pound global scam, which he spent on luxury hotel stays, gambling and a Rolex watch.

The National Crime Agency (NCA) considers it the most serious case of cybercrime it has investigated, the court heard.

Passing sentence on Tuesday, the judge, Timothy Lamb QC, said: “The harm caused by your offending was extensive – so extensive that there does not appear to be a reported case involving anything comparable.

“Whatever your motivation for mounting these attacks on the internet you took the opportunity to spend large sums of ill-gotten money in casinos, on an expensive watch and luxury hotel services.

“All the constituent offences were part and parcel of your role as the self-styled ‘K!NG’ of the internet. It has been asserted on your behalf you are remorseful. I have seen no outward expression of that.”

The former computer science student, who committed most of his crimes when aged between 18 and 19, remained expressionless as the sentence was passed.

Qaiser, of Barking, east London, bought advertising space on pornography sites using the online name K!NG, said Joel Smith, prosecuting. But when users clicked the corrupted links, their computers were exposed to highly sophisticated “angler” software.

Infected computers showed a message impersonating law enforcement in the user’s country saying an offence had been committed and demanding payment of up to $1,000, the court heard.

The screen of a computer after being locked by the malware. Photograph: NCA/PA

The criminal group collected multimillion-pound profits from victims in more than 20 countries, although the total number of people scammed is unknown, the NCA said.

Some advertisers were “happy to turn a blind eye” to Qaiser’s actions but those who tried to stop him “became the subject of the defendant’s anger”, Smith told the court. Qaiser then blackmailed them and tried to flood their servers with DDoS (distributed denial of service) attacks, putting the sites out of action and costing several businesses hundreds of thousands of pounds, he said.

He also threatened to spam their sites with child pornography, the court heard.

Qaiser was charged in February 2017 but a trial set for February 2018 was abandoned when he was sectioned under the Mental Health Act.

While he was detained at Goodmayes hospital in north-east London, the hospital wifi was used to access online advertising websites Qaiser had used for his offending, the court heard.

In December, he was arrested accused of laundering about £120,000 while on bail and was charged and remanded in custody.

Smith said prosecutors suspected Qaiser had money stored in offshore accounts but they had been unable to directly trace them so far.

Qaiser, who initially denied the crimes and claimed he had been hacked, entered guilty pleas to an 11-count indictment.

He admitted three counts of blackmail; three counts of fraud by false representation; four counts of doing an unauthorised act with intent to impair the operation of a computer; and one count of possessing criminal property.

The ransomware offences were committed between 2012 and 2014, while the money-laundering offence was committed between 2015 and 2018.