German train operator Mitteldeutsche Regiobahn (MRB) says it is introducing women-only train carriages.
In the coming weeks each train on the line between Leipzig and Chemniz in east Germany will have two compartments installed which are for women and children only.
The carriages will be put in the middle of the train next to the conductor to make women feel safer.
"It has been deliberately decided to place them near a customer service representative," a spokesman for MRB said.
Mexico, Brazil, Egypt and India all adopt a similar measure - and Opposition leader Jeremy Corbyn has made a suggestion that such action should also be taken to protect women in the UK.
During the Labour leadership campaign, Corbyn said: “I would consult with women and open it up to hear their views on whether women-only carriages would be welcome - and if piloting this at times and on modes of transport where harassment is reported most frequently would be of interest.”
The suggestion was condemned by Yvette Cooper, who was also vying for party leadership. In response to Corbyn's remarks she tweeted: "Why should we have to shut ourselves away to stay safe?"