California Gov. Gavin Newsom signed a new law on Wednesday that aims to stop other states from prosecuting doctors and pharmacists who mail abortion pills to patients in places where the procedure is banned.

California already has a law protecting doctors who provide abortions from out-of-state judgments. But that law was designed to protect doctors who treat patients from other states who travel to California.

The new law forbids authorities from cooperating with out-of-state investigations into doctors who mail abortion pills to patients in other states. It also bans bounty hunters or bail agents from apprehending doctors and pharmacists in California and transporting them to another state to stand trial for providing an abortion.

Other states, including New York and Massachusetts, have similar laws. But California’s law also bars state-based social media companies — like Facebook — from complying with out-of-state subpoenas, warrants or other requests for records to discover the identity of patients seeking abortion pills.

“Health care providers, physically located in California, will be able to offer a lifeline to people in states that have cut off access to essential care, and be shielded from the draconian laws of those states,” state Sen. Nancy Skinner, a Berkeley Democrat and author of the bill, said in a statement.

The law only protects doctors and pharmacists who reside in California. If a doctor or pharmacist leaves California to provide care to a patient in another state, the law would not protect them.

“We will continue to protect women and health care workers who are seeking and providing basic care,” Newsom said in a news release announcing he had signed the law. The California Catholic Conference opposed the law, arguing the state is “engaging in ideological colonization against states and citizens that do not want abortion.”