Terraform Labs, the bankrupt cryptocurrency firm behind the fallen algorithmic stablecoin TerraUSD (UST), has been granted permission by U.S. Bankruptcy Judge Brendan Shannon to retain the law firm Dentons for its legal representation, Reuters reported.

The approval came during a bankruptcy court hearing in Delaware, where the judge found the legal spending necessary.

This decision follows a contentious debate with the Securities and Exchange Commission (SEC) and Terraform’s creditors, who had opposed the US$166 million legal fee arrangement.

The court’s ruling allows Terraform Labs to maintain its legal defense with Dentons, despite the SEC’s challenge regarding the substantial retainer fee.

Dentons has agreed to return US$48 million to Terraform and submit future legal work to increased oversight by the bankruptcy court.

Terraform and the law firm will be preparing for a trial later this month, where it faces allegations of securities fraud by the SEC.

The agency has accused Terraform Labs and its founder and former chief executive Kwon Do-hyung (also known as Do Kwon) of offering and selling securities in the form of cryptocurrencies and orchestrating a multi-billion dollar securities fraud involving its algorithmic stablecoin UST.

The collapse of TerraUSD in May 2022 had a significant impact on the cryptocurrency market, leading to the bankruptcies of several major crypto firms.