Canada's Senate on Friday passed a bill that would allow terminally ill people to end their lives with assistance from a doctor.

The bill passed easily, 44-28, ending a political deadlock between the upper and lower houses. It will become law after royal assent by the governor general, a step that is largely a formality.

The limitation of doctor-assisted suicide to those who are terminally ill had been a point of contention in lawmakers' debates. Some senators wanted to broaden the criteria under which people could seek a doctor's help to die, but the House, led by Prime Minister Justin Trudeau, argued for strict limits.

The legislation also would allow medically assisted suicide only for those who qualify for government-funded health services in Canada — a measure to prevent people from traveling to Canada to die.

Canada's Supreme Court struck down an old prohibition against doctor-assisted suicide in 2015 and gave the government one year to draft legislation regulating the practice.