(link to the original article) Under the law anyone who makes a woman observe the custom faces a three-month jail sentence and a $30 (£23) fine.
The practice, known as chhaupadi, has been in the spotlight recently after two women died while sleeping in sheds.
Campaigners say the legislation must be properly enforced, but say behaviour also needs to change.
Under the ancient Hindu practice, women who have their periods or who have just given birth are seen as impure or as bringers of bad luck, and can be forced to sleep in huts or cattle sheds.
They are banned from touching cattle and men, denied access to some foods and can be barred from toilet and washing facilities in the house, forcing them to walk long distances from their villages.
They can also be exposed to extreme cold in the winter and criminal attacks, and young women cannot go to school.
Last month a teenage girl died after being bitten by a snake while sleeping in a hut outside her home during her period.
Her death followed that of a 15-year-old in December 2016, who suffocated after lighting a fire in the shed where she was staying to keep warm.
Chhaupadi was formally outlawed by the Nepalese government in 2005 but no penalties were put in place, and it still continues in remote western rural areas of Nepal.
The new law, passed on Wednesday, states that menstruating women or those who have just given birth should not be “kept in chhaupadi or treated with any kind of similar discrimination or untouchable and inhuman behaviour”.
Krishna Bhakta Pokharel, an MP and co-ordinator of the subcommittee that drafted the law, said the legislation would come into force in a year.
“For the next year we will conduct social campaigns to tell the people about this new law,” he said.
- In many world religions, women are seen as impure during their periods
- They are restricted from entering places of worship and following religious rites
- The chhaupadi tradition followed by Hindus in western Nepal is the most extreme version where women are banished outside during their monthly cycle
- In India, women are not allowed enter some Hindu temples and Muslim mosques while menstruating but there have been court cases to overturn this
- In southern India, a girl reaching puberty is celebrated with a party and presents
- In the Dogon tribe in Mali, women of the village also live in a hut during their periods
Pashupati Kunwar, a campaigner against Chhaupadi from the western district of Achham, told the BBC she was “very happy” that the law had been passed.
“It was a long struggle for us to raise awareness against the inhuman practice of Chhaupadi,” she said. “Now the government should be proactive in enforcing this law. It must be enforced if it is to have any meaning.”
Apsara Neupane, who was recently elected deputy mayor of Chandannath municipality in western Nepal, said the main problem was changing people’s behaviour.
“Having a strong law is important but reforming social customs may take more time,” she said. “In any case, I am glad to see that there has been a gradual change in how people perceive the Chhaupadi practice.”
A US state department human rights report, citing figures from a survey in Nepal in 2010, said 19% of women between the ages of 15 and 49 practised chhaupadi across the nation.