France's parliament on Tuesday approved legislation that makes sexual harassment a crime, addressing problems many say have existed for decades in the country.

The new law sets three levels of harassment, with the most serious — in cases where the harasser has authority over the victim, the victim is younger than 15 years old, or multiple people carry out the harassment — punishable by up to three years in prison.

The National Assembly passed the law after the Senate voted earlier in the day. Its passage comes more than two months after a court struck down the previous statute, saying it was too vague and failed to protect women.

The legislation covers offences in universities, the housing market and job interviews. Single acts of sexual blackmail will be considered sexual harassment, whereas previously only repeated acts were.

The law comes two weeks after male legislators broke out in hooting and catcalls when a cabinet minister stood to speak while wearing a blue and white flowered dress. The hecklers later said they were merely showing their appreciation on a warm summer's day.