California lawmakers gave final approval Friday to a bill that would allow terminally ill patients to legally end their lives.

The measure faces an uncertain future with Gov. Jerry Brown, a former Jesuit seminarian who has not said whether he will sign it.

Senators approved the bill on a 23-14 vote after an emotional debate on the final day of the legislative session.

"Eliminate the needless pain and the long suffering of those who are dying," urged Sen. Lois Wolk, D-Davis, one of the bill's co-authors.

Opponents said the measure could prompt premature suicides.

"I'm not going to push the old or the weak out of this world, and I think that could be the unintended consequence of this legislation," said Sen. Ted Gaines, R-Roseville.

The measure to allow doctors to prescribe life-ending medication succeeded on its second attempt after the heavily publicized case of Brittany Maynard. The 29-year-old California woman with brain cancer moved to Oregon to legally take her life.

Her relatives tearfully watched the debate from the Senate floor, while supporters lined the Senate balcony.

A previous version passed the Senate but stalled in the Assembly until lawmakers there took it up in a special legislative session. The move to bypass the usual process drew criticism from the governor.

The revised measure includes requirements that the patient be physically capable of taking the medication themselves, that two doctors approve it, that the patient submit several written requests, and that there be two witnesses.

Doctors in Oregon, Washington, Vermont and Montana already can prescribe life-ending drugs.