SYDNEY (Reuters) - Australia’s second-largest state on Wednesday took another step towards adopting a law allowing voluntary assisted dying for terminally ill patients.

Any resident of Victoria state over 18, with a terminal illness and with less than six months to live can request a lethal dose of medication under the new legislation.

Assisted dying will remain illegal in Australia’s other five states.

In a vote in Victoria’s upper house, 22 of 40 senators supported the legislation.

The legislation required amendments to pass the upper house, including halving the time frame for eligible patients to access the scheme, reduced from 12 months to live to six months to live.

The amendments must be approved by the lower house before becoming law. The legislation is not expected to be opposed.

There will be exemptions for sufferers of conditions such as motor neurone disease and multiple sclerosis, who can request a lethal dose of medication even if they have been given up to a year to live.

Many countries have legalized euthanasia, including Canada, the Netherlands, Switzerland, and some states in the United States.

But Australia’s federal government has opposed legalizing euthanasia even though the remote Northern Territory, which does not hold Australian statehood, became the first jurisdiction in the world to do so in 1995.

The federal government enacted its own legislation to override the Northern Territory law in 1997 under rules allowed by the constitution. State law, however, can not be overridden.