HELENA, Mont. (AP)  A Montana judge has ruled that doctor-assisted suicide is legal in the state, but the decision is likely to be appealed.

The judge, Dorothy McCarter, issued the ruling late Friday in the case of a Billings man with terminal cancer who had sued the state.

In her ruling, Judge McCarter wrote that “the Montana constitutional rights of individual privacy and human dignity” give a mentally competent person who is terminally ill the right to “die with dignity.”

The ruling said that those patients had the right to obtain self-administered medications to hasten death if they found their suffering to be unbearable, and that physicians could prescribe such medication without fear of prosecution.