The French parliament has voted overwhelmingly in favour of a law allowing terminally ill patients to cease treatment and enter a “deep sleep” until they die.

The measure stops short of legalising euthanasia, which remains a divisive issue in French politics, but the government has said the law would give patients on the brink of death more control at the end of their lives.

The Socialist president, François Hollande, unpopular and under pressure over high unemployment and a flagging economy, is trying to shape his legacy as a social reformer. The “deep sleep” law comes after his government legalised gay marriage in 2012 amid huge street protests.

The new law allows patients who are at the end of their life and who are suffering despite their treatment, to enter deep, continuous sedation until death. It was described by the centre-right MP and doctor Jean Leonetti, who helped to draw up the law, as “sleep before death to avoid suffering”. In effect, the measure allows patients with hours or days to live to request to be placed under general anaesthetic until the moment they die.

The law would also allow people to make legally binding declarations, or “living wills”, stating that they do not want to be kept alive artificially if they are too ill to decide. These declarations already existed in France but were only valid for three years and doctors were free to disregard them.

However, the new law has faced criticism from pro-euthanasia campaigners and some in Hollande’s Socialist party who said it did not go far enough or meet the president’s 2012 campaign promise to legalise voluntary euthanasia. The state of deep sleep is irreversible, but it stops short of assisted suicide and is different from euthanasia in that the time of death cannot be determined.

The government, keen to avoid another divisive social issue that could prompt anger and street protests, was steadfast in refusing to go as far as legalising euthanasia. An amendment allowing for a further-reaching clause on “medical assistance to die” was rejected.

A BVA poll this weekend showed 96% of French people were in favour of putting patients into a deep sleep if they are able to make the decision themselves. Eighty per cent of French people felt the law should go further and legalise euthanasia.

Several Green and radical left MPs abstained in the vote, arguing the law does not go far enough. On the right, some MPs felt the law went too far towards allowing euthanasia.

The bill will now be examined by the French Senate before the summer.