Image copyright AP Image caption Debbie Ziegler - holding a photo of her daughter, Brittany Maynard - hugs a supporter after the measure was passed

California lawmakers have passed legislation that would allow terminally ill patients to end their lives with a doctor's supervision.

The California Assembly narrowly passed the bill on Wednesday, and the state senate is expected to follow suit.

The bill is partly inspired by the case of a terminally ill California woman who moved to Oregon to end her life.

At least two dozen states introduced aid-in-dying legislation this year, but none has become law.

California Governor Jerry Brown has not said whether he will sign the bill.

On Wednesday lawmakers talked about their faith as both reasons to support and oppose the bill.

"We have the ability to allow others to have a choice," said Assemblywoman Catharine Baker. "I believe it is cruel, nothing short of cruel, to deny them that choice in their final hours and days."

'Miraculous turnarounds'

Assemblyman Mike Gibson questioned the bill's time frame that requires a doctor to have given a six months or less to live diagnosis.

"I have seen so many miraculous turnarounds in people's lives when the doctors have given up. The doctors have said, 'Do funeral arrangements,' and the prognosis has changed within a matter of hours," he said.

Brittany Maynard, who was a California resident who was dying of brain cancer, made her plight public and eventually moved to Oregon to legally end her life.

Currently, doctors are allowed to prescribe life-ending drugs in the US states of Oregon, Washington. Vermont and Montana.