HELENA, Montana — The state House has passed a measure to make it illegal for doctors to prescribe life-ending medication to terminally ill patients who ask for it.

Under House Bill 477, physician assisted suicide would become a crime punishable by prison time in fines. It passed 51-48 Monday and now goes to the Senate for consideration.

The Legislature has struggled to clarify whether the practice is legal or illegal since the Montana Supreme Court ruled in 2009 that nothing in state law prohibits physicians from giving aid in dying. The high court said doctors could use a patient's request for the medication as a defense against any criminal charges.

The House defeated a similar measure in February and defeated HB477 on Friday, but brought it back for reconsideration on Saturday.