SACRAMENTO, Calif. (AP) — Judges in California and South Carolina have ordered cellphone carriers to disable nearly 200 contraband cellphones used by inmates to orchestrate crimes behind and outside prison walls, the most sweeping order of its kind ever won by corrections officials.

It’s an important victory for prison officials who have been frustrated by their inability to stop the flow of smuggled phones that are used to coordinate drug deals, gang operations and killings. Even murderous cult leader Charles Manson, who died in November, obtained phones and used them to communicate with followers outside prison.

The warrant essentially orders carriers to “turn these phones into bricks,” California Corrections Secretary Scott Kernan told The Associated Press on Monday. The phones will be shut down over the next week or two, he said.

Kernan expects other states will follow the lead of South Carolina and California and ask judges to approve broad shutdowns. He said the ruling is a big step forward in addressing the intractable and related issue of drugs and cellphones in prisons.

Last February, federal prosecutors said two inmates used smuggled cellphones to run a violent, drug-dealing street gang from inside California’s super-maximum-security Pelican Bay State Prison. And South Carolina officials blamed a prison riot that killed seven inmates in April on a turf war between gangs over territory, money and contraband items such as drugs and cellphones.

The wireless industry has long been able to remotely disable cellphone if they are lost or stolen. But the industry has said it needs a court order before it can shut down the devices at the request of the government.

The goal is to not only stop inmates from using the phones to orchestrate crimes, but to disrupt the lucrative smuggling of cellphones by prison employees and others that Kernan said can bring the smuggler “about $1,500 a pop on the (prison) black market.” California authorities seized more than 13,000 cellphones last year alone, the most since 2011, “so you can do the math. That’s a lot of black market.”

Getting an order to shut down multiple cellphones is more efficient and cheaper that tracking them down and confiscating them one at a time.

In California, a Kern County judge on Friday ordered all the major carriers to shut down 97 devices including cellphones and SIM cards at Kern Valley State Prison in Delano, north of Bakersfield. A South Carolina judge issued a similar warrant for about 100 cellphones at one prison there, also on Friday, California officials said.

California plans to obtain similar warrants to regularly shut down phones in other prisons, Kernan said.

Corrections department Special Agent James Rochester cited the “voluminous offenses committed by the use of cellular phones” and “the direct link these phones have to the commission of crimes” as reasons for the judge granting the warrant. He said hundreds of inmates have told him they can easily obtain the phones that he said in his sworn affidavit have been used to coordinate violent crimes including assaults and murders along with narcotics and firearms trafficking.

It has long been illegal for inmates to have cellphones in prison. Prison officials identified the contraband phones using cellphone signal-capturing devices that were installed years ago at 18 of the California’s 35 prisons. They halted expansion of that program in 2015 for fear the technology was being outpaced by advances in cellphones’ sophistication.

South Carolina officials used similar technology to identify the illicit cellphones there, Kernan said.

California has since installed nearly 1,000 sophisticated metal detectors, scanners and secret security cameras in prisons to detect and deter the smuggling of cellphones and other contraband like drugs. That effort was paid for by Virginia-based Global Tel-Link, the nation’s largest prison phone company, from the projected $17 million it receives each year from California inmates and their families who use landlines to make phone calls that are monitored for security reasons.