A keen karate practitioner was able to fend off two illegal migrants accused of attempted rape by “kicking them in the balls” in the town of Forfar, Scotland.

The woman was walking home from the Royal nightclub when 28-year-old Mohammad Islam and 48-year-old Shehab Smekramuddin attacked her, the Scottish Sun reports.

Dundee Sheriff Court heard that the woman had left the club after spotting one of the migrant men staring at her and was walking down the High Street towards home when Islam, who was observed stalking her 300 yards back with his accomplice by CCTV cameras, suddenly appeared.

While he asked the woman if she wanted to be “walked home” to distract her, Smekramuddin pounced on her from behind, pinning her to ground.

But the plucky Scotswoman fought back harder than expected, throwing punches at her attackers, headbutting them, and kicking them — in her own words — “in the balls”, enabling her to escape.

Migrant In Court For Violent Rape: ‘I Came to Austria to F*** the Women’ https://t.co/55dOG9Bjq8 pic.twitter.com/HSezfmN5hi — Breitbart London (@BreitbartLondon) September 19, 2016

“My mind went blank – I thought I was going to be raped,” the victim told the court.

“The incident has had a big effect on me. I’ve had a lot of panic attacks and anxiety. I feel very uncomfortable and insecure.”

The fiscal depute — a type of Scottish prosecutor — Eilidh Robertson told the jury that the victim had given “powerful and persuasive evidence” the migrants, and asked: “She dropped her bag during the struggle and the men weren’t interested in that – so what were they interested in?”

She added: “If they hadn’t picked someone proficient in karate to target then [the victim] being raped may well have happened.”

However, while they were initially charged with assault with intent to rape, they were ultimately convicted only for assault, with intent to rape deleted from the charge — which should mean a significantly softer sentence.

Follow Jack Montgomery on Twitter: @JackBMontgomery