Under a new law, pharmacists who undergo special training will be able to provide 60-day supplies of preexposure prophylaxis, commonly called PrEP and sold under the brand name Truvada, as well as doses of post-exposure prophylaxis, or PEP, meant to be used in an emergency after possible exposure to the virus, without a doctor’s prescription. Studies have found that the drugs are very effective, but many people at high risk of infection do not take them.

“All Californians deserve access to PrEP and PEP, two treatments that have transformed our fight against HIV and AIDS,” Gov. Gavin Newsom, who signed the bill into law Monday, said in a statement. “I applaud the Legislature for taking action to expand access to these treatments and getting us closer to ending HIV and AIDS for good.”

Federal data shows that there are about 40,000 new HIV infections nationwide each year, and black and Latino men who have sex with men are at the greatest risk. In his State of the Union address in February, President Donald Trump vowed to stop the spread of HIV by 2030, and wider access to PrEP is a linchpin of that effort.

The bill, SB 159, was sponsored by state Sen. Scott Wiener of San Francisco and Assemblyman Todd Gloria of San Diego. Wiener, a former member of the San Francisco Board of Supervisors who represented Harvey Milk’s old district, declared in 2014 that he was taking Truvada daily. At the time, he said he hoped his announcement would encourage more gay men to consider taking the drug. On Tuesday, he said the new law would make it easier for them to do so.

“There are big swaths of California where it is hard to get a doctor’s appointment, and sometimes people have to wait months,” he said. “Giving people the option of going into their neighborhood pharmacy and getting a 60-day supply to start on PrEP will make a big difference.”

Some medical groups had initially opposed the bill because they were concerned that patients could take Truvada long term without medical supervision. In a compromise, the bill was revised to guarantee a maximum of 60 days of PrEP treatment without a doctor’s prescription. After that, a prescription is needed.

The law also specifies that patients must show proof that they have tested negative for HIV in the previous seven days before they can be provided with the preventive drugs.

According to Morgan Carvajal, a legislative advocate at the California Medical Association, it is crucial to test for HIV before starting PrEP or PEP. If a patient who has HIV takes those drugs, she said, the virus can become resistant to key ingredients that are also found in medicines used to treat the virus. That could limit a patient’s treatment options down the road.

She added that regular medical checkups for PrEP users are also essential to check renal function every six months — the drug can have adverse side effects on the liver, kidneys and bones — and to test for other sexually transmitted diseases.

Besides worries about the drug’s side effects, several other factors may contribute to low rates of Truvada use, including its high cost — about $20,000 a year, if one is paying full price — and stigma associated with its use.

“We have this highly effective drug and the ability to prevent HIV, but getting it to people who need it is more of a challenge,” Jen Kates, director of global health and HIV policy at the Kaiser Family Foundation, said Tuesday. “Being able to go to a pharmacy is much easier than going to a primary doctor. More people who are at risk will be able to get the medication that will prevent them from becoming HIV positive.”

Truvada, made by Gilead Sciences, has been the only HIV-prevention drug on the market since its approval in 2012. But last week, the Food and Drug Administration approved a second HIV-prevention drug, Descovy, also made by Gilead, which may have fewer side effects. That drug has not been tested on everyone, however, and was approved for use only by cisgender men and transgender women.

Dr. Aaron S. Lord, a New York University School of Medicine neurologist and a founder of a campaign that calls on the government to break Gilead’s patent on Truvada to make PrEP more affordable, applauded the new law.

“I think what California is doing is exactly the kind of innovative response that we need in order to end the epidemic of HIV infections,” he said.

The California law will also require Medi-Cal, the state’s version of Medicaid, to cover HIV-prevention drugs obtained from pharmacies, and prohibits insurance companies from requiring prior authorization to cover the drugs. It will go into effect in July.

This article originally appeared in

.