Local authorities just busted one of the largest dark web drug-peddling rings ever – a New Jersey-based operation that raked in millions of dollars dealing in counterfeit Xanax, officials announced Tuesday.

Seized in the bust was the largest quantity of illicit pills in New Jersey history, authorities said.

And the complex scheme unraveled thanks to a low-level staffer in the Manhattan DA’s Office, who was the first to suspect signs of the illegal operation, sources said.

“This is like a parking ticket leading to the takedown of a multimillion-dollar case,” a New Jersey police source told The Post.

Three New Jersey men — Chester Anderson, 44, of South Brunswick, Jarrette Codd, 41, of Jamesburg and Ronald MacCarty, 51, of Jackson – were indicted Tuesday for operating the ring’s “storefronts” on the dark web, a hidden part of the internet only accessible through a special browser that doubles as a haven for illegal activity.

Officials say the men sold and shipped counterfeit Xanax tablets and other controlled substances to buyers in 43 states who purchased the drugs using bitcoin.

The ring then laundered its take — $2.3 million in cryptocurrency — by using preloaded debit cards and withdrawing more than $1 million in cash at ATMs in Manhattan and New Jersey, officials said.

Authorities raided the suspects’ homes and vehicles and seized the historic pill quantity, including 420,000 to 620,000 in counterfeit Xanax – which have a street value of roughly $3 million — as well as 500 glassines of fentanyl-laced heroin and other substances, officials said.

According to a law enforcement source, an eagle-eyed low-level staffer in the Manhattan DA’s office spotted suspicious large ATM withdrawals in 2017 and began investigating, sparking what eventually turned into a massive probe.

It was a classic case of “follow the money,” DA Cy Vance said at a press conference Tuesday.

“Today our crime scene is the iInternet. It is in cyberspace,” said Vance, who called the suspects “a very large-scale independent group of drug-sale entrepreneurs who finally got a little bit over their head and got caught.”

It’s the first time a New York state prosecutor took down a dark web storefront.

Officials say the men started the drug operation in 2016 using Dream Market, which operates on a hidden service of the Tor network.

“It’s a lot like Amazon.com,” Vance said of Dream Market. “You have a shopping cart, and you have seller ratings.”

The New Jersey men’s operation had “good ratings, apparently,” Vance said.

“Unlike Amazon, a majority of the sellers on Dream Market are selling material that is illegal,” the district attorney said.

Prosecutors said Anderson operated two dark web storefronts using the screen name “sinmed” to sell the Xanax pills and other substances, including fentanyl-laced heroin.

Codd, a small-time contractor, and MacCarty, the owner of a cellphone repair store in New Jersey called The Wireless Spot, assisted in manufacturing and equipment procurement, authorities charge.

Officials say Anderson and MacCarty created a shell company, Next Level Research and Development, to buy more than 2,200 pounds of microcrystalline cellulose, a primary ingredient used to manufacture pharmaceutical tablets.

MacCarty then helped the trio purchase a pill press, powder mixer and “punch dies” used to imprint “Xanax” labels on alprazolam pills.

During the investigation, undercover Manhattan DA investigators purchased about 10,000 counterfeit Xanax pills along with ketamine and GHB, a date rape drug, from the online storefronts.

Nearly all of the drug packages had return addresses that falsely identified the sender as a Manhattan business, including multiple Manhattan law firms and a real estate agency.

Vance said the case should be a “warning” to those who operate illegally on the dark web.

“We are competent in the space, and we know how to find you,” Vance said. “We will make these cases, and we will prosecute you.”

Anderson, Codd and MacCarty were charged in a Manhattan Supreme Court indictment with conspiracy in the fourth and fifth degrees and money laundering in the first degree.

Additionally, Anderson was charged with multiple counts of criminal sale of a controlled substance and identify theft.