SAN ANDREAS, Calif. — More than 27,000 marijuana plants were seized and 35 people arrested in a series of raids in a California county that is trying to crack down on illegal grows as the state prepares to become the world’s largest marijuana marketplace when recreational pot is legalized next year.

The crackdown on more than a dozen farms occurred over four days in different parts of Calaveras County, southeast of Sacramento in the foothills of the Sierra Nevada Mountains. Sheriff Rick DiBasilio said Thursday it was the largest series of raids in county history.

“I want to tell all of the illegal growers that decide to come to Calaveras County: Don’t come, you’re not welcome and we will come for you,” DiBasilio said at a news conference.

The National Guard, as well as the district attorney’s office, the California Highway Patrol and state and county environmental offices were involved in the operation, which took six months of planning, DiBasilio said.

One of the targeted farms, where more than 6,000 plants were seized, is affiliated with the same Rastafarian Church linked to a Yuba County pot farm that on Tuesday was the scene of a police shootout. A farmworker there shot two deputies after running into a nearby home and later was found dead inside.

The Calaveras County sheriff’s office made five arrests without incident at the farm in Heiser Canyon on Wednesday, DiBasilio said. The Calaveras farm was targeted before Tuesday’s shooting.

Heidi Lepp, the leader of Sugarleaf Rastafarian Church, said the Heiser Canyon farm is part of her network of churches, which use marijuana as their sacrament. She claims the farms that grow pot for the church have a religious exemption allowing such cultivation, but state law does not provide such exceptions.

DiBasilio said the Heiser Canyon farm was an illegal grow. Medical marijuana has been legal in California for two decades and he said last year the farm tried to get a license to allow it to grow pot but was turned down.

DiBasilio said Lepp called the sheriff’s office on Wednesday and said the farm was affiliated with her church and could not be raided. The workers arrested at the farm said they did not know who they were working for, he said.

Lepp’s husband, Charles Lepp, said they have no ownership of the property.

“We are the head of the church, and Heidi does all she can to protect the people that belong to the church,” he said.

The raids began with 23 search warrants and resulted in 25 tons of marijuana being eradicated, authorities said. Eleven firearms and $7,000 in cash were also seized. In addition to illegally growing weed, the farms in question committed multiple environmental violations, officials said. The cases are now in the hands of the district attorney’s office.

The seized marijuana is taken to a local landfill where it is buried about eight feet under the ground, DiBasilio said.

Calaveras County officials are considering banning commercial marijuana growing altogether, despite the statewide legalization that begins Jan. 1.