A German inventor has created rape-proof knickers in the wake of a spate of sex attacks.

The underwear comes equipped with a combination lock and a loud alarm which goes off if they are tampered with.

German media has reported the pants are so popular some online shops have sold out.

The wearer puts a combination lock on and if they are tampered with the alarm is triggered

The manufacturers say they are simple to use and give the wearer a sense of security

Because of the lock, the pants cannot be pulled off and they are made with a material which is almost impossible to cut through or tear.

The 130-decibel alarm is automatically activated if the garment is cut off.

The advertisement for the pants reads: 'Scarcely a day passes without headlines of sexual assaults.

'Only recently, a father in Kleve could barely prevent an attempted rape of his daughter. Brand new on the market of deterrence: underpants with a number lock.'

But security comes with a price - one pair of the pants costs 100 euros (£87).

The 'safe shorts' come in two different styles - the one on the left can be worn under shorts or a short skirt, while the one on the right is designed to go under trousers or a dress

There has been a mixed reaction to the 'safety shorts' on the Internet.

One social media user in Germany wrote: 'The idea is good. One never knows what is going on in these heads of the perpetrators. Yet honestly, it is actually bad that one had to invent such a doubtlessly well-intentioned thing.'

But another user claimed: 'What if the women are directly threatened with weapons and forced to open the lock if the perpetrators do not succeed?'

When anti-rape underwear was first mooted in America in 2013 feminist writer Louise Pennington described it as a 'modern chastity belt' and added: 'Let's focus on men preventing rape by not raping rather than curtailing women's freedom to exist.'

Similar safety devices, such as small alarm systems for handbags, have recently gone on the market in Germany to protect women from possible attacks.

On New Year's Eve 2015 celebrations in Cologne were marred by mass sex attacks on women and last year and in October, Maria Ladenburger, 19, was raped and murdered in the city of Freiburg.