A court in New Zealand has denied internet mogul Kim Dotcom's bid to avoid being sent to the United States where he faces criminal charges.

The decision Monday follows an epic legal battle that has pitted Dotcom against the U.S. and New Zealand governments.

Dotcom is the flamboyant founder of file-sharing site Megaupload, which was shut down by the U.S. government. He was arrested in January 2012 in a spectacular raid by New Zealand police on his luxury mansion in Auckland, the country's largest city.

Related: Kim Dotcom wins fight to live-stream court hearing on YouTube

Dotcom and three of his former business associates are wanted in the U.S. for charges including conspiracy to commit racketeering and money laundering. They deny the accusations and have been fighting hard against extradition, arguing that Megaupload was simply a file-sharing website and that they shouldn't be blamed for what others were uploading to it.

On Monday, New Zealand's High Court ruled that the four men are eligible to be handed over to U.S. authorities, the same outcome as an earlier decision of a lower court. But Dotcom's lawyers say they're not giving up and will now take the case to the Court of Appeal.

Extradition Judgement in a nutshell:



We won but we lost anyway ⚖️🚽 — Kim Dotcom (@KimDotcom) February 20, 2017

They are pointing to what they say is a contradiction in the High Court's judgment.

Although the four men are accused by U.S. authorities of profiting from copyright infringement through the file-sharing website, the High Court acknowledged Monday that there's no relevant criminal offense under New Zealand's copyright law.

Related: Prince label accuses Jay Z company of copyright infringement

Instead, the court found that Dotcom and his associates were eligible for extradition under conspiracy to defraud and potentially other serious crimes.

"I'm no longer getting extradited for Copyright. We won on that," Dotcom tweeted after the ruling. "I'm now getting extradited for a law that doesn't even apply."

I'll be watching as the legal profession dissects this extradition judgement in a copyright case that is no longer a copyright case. 😜 — Kim Dotcom (@KimDotcom) February 20, 2017

The U.S. has accused Dotcom and his associates of operating an "international organized criminal enterprise responsible for massive worldwide online piracy of copyrighted works."

During his years-long legal fight, Dotcom has found plenty of other ways to cause a stir in New Zealand, founding his own political party and teaming up with Edward Snowden to accuse the country's leader of misleading the public.

He was born 1974 as Kim Schmitz in Germany and is also a citizen of Finland. Before Megaupload was shut down, he employed more than 50 staff in New Zealand and also rented a suite at the Grand Hyatt Hotel in Hong Kong.

Dotcom's three former co-workers who are also fighting extradition are Mathias Ortmann, Finn Batato and Bram van der Kolk.

-- Chieu Luu contributed to this report.