SACRAMENTO (AP) — The California Senate approved a plan Monday that would require the state to hand out condoms at adult prisons, despite a ban on having sex behind bars.

The bill by Assemblyman Rob Bonta, D-Oakland, aims to cut the spread of HIV, Hepatitis C and other diseases in prisons and communities where felons are paroled.

It would require the California Department of Corrections and Rehabilitation to make condoms initially available in five prisons by 2015 and in all 33 adult prisons by 2020.

Democratic lawmakers said AB999 addresses a public safety issue as well as a potential way for the state to save money.

“If those inmates get sick while they’re in prison, that costs you … a condom is cheaper than treating the disease after they get it,” said Sen. Rod Wright, D-Los Angeles, who carried the bill in the Senate.

Other lawmakers have said handing out condoms would be encouraging inmates to break the law. It is a felony to have sex in prison.

The Senate approved the proposal 21-13, sending it to the Assembly.

If the bill becomes law, California would join Vermont, with a much smaller inmate population, in providing condoms to all prisoners. Canada, most of the European Union, Australia, Brazil, Indonesia and South Africa already take that step, according to legislative researchers.

Then-Gov. Arnold Schwarzenegger vetoed a 2007 bill that would have allowed nonprofit and health organizations to provide condoms to state prisoners. But in his veto message, the Republican governor instructed the corrections department to test a condom distribution program in one prison.

About 800 inmates in California State Prison, Solano, 30 miles southwest of the state capital, had access to free condoms in vending machines for a year starting in November 2008. In a 2011 report on the pilot program, public health officials found few problems and recommended the program be expanded.

Today, California state prisoners have limited sanctioned access to condoms. Spouses and domestic partners are allowed to bring as many as 10 on overnight family visits with lower-level offenders who qualify for the incentive program, but the condoms must be accounted for and are not permitted outside visiting areas.