EU member countries and lawmakers reached an agreement on Tuesday on the bloc's first rules to tackle violence against women, the European Parliament and officials said.
The law seeks to protect women in the 27-nation European Union from gender-based violence, forced marriages, female genital mutilation and online harassment.
The European Commission, the EU's executive arm, first proposed the major legislation on March 8, 2022, to mark International Women's Day.
"It's a clear message across the union that we take violence against women seriously," EU lawmaker Frances Fitzgerald told reporters in Strasbourg after the announcement.
"It is a directive that the women and girls all across the European Union have asked for for over 30 years," another lawmaker, Evin Incir of Sweden, said.
"For the first time ever, we criminalise widespread forms of cyberviolence, such as non-consensual sharing of intimate images," Vera Jourova, European Commission vice president for values and transparency, said on social media.
The text criminalises cyberstalking, cyberharassment and cyber incitement to hatred or violence across the European Union.
It does not, however, include a common definition of rape, which proved to be the most controversial point in negotiations.
"We could not get consent-based definition of rape into this directive. So that is a very big disappointment," Fitzgerald said.
Although the text does not contain a definition of rape, member states will aim to raise awareness that non-consensual sex is considered a criminal offence, the parliament said in a statement.
The commission will have to report every five years on whether the rules need to be updated, it added.
The parliament and at least a dozen EU countries including Belgium, Greece and Italy had wanted to include a definition of rape.
But a dozen other countries, including France, Germany and Hungary, opposed doing so, arguing the EU had no competence in the matter.
The states in opposition argued that rape does not have the cross-border dimension, necessary for it to be considered a crime that comes with common penalties in the bloc.
The parliament and the commission strongly disputed that position, insisting that rape could fall within the framework of "sexual exploitation of women", for which there is already a joint set of penalties.
The reluctance to agree a definition of rape sparked controversy in France, where President Emmanuel Macron had said tackling violence against women would be a priority of his second term.
Macron had already elicited criticism after defending the presumption of innocence for Gerard Depardieu, who has been charged with rape and sexual harassment.