A woman said she deliberately scratched a burglar while he was trying to steal her laptop in order to get his DNA.
Annie-Laure Promonet, 42, found a man in her home in Watford, Hertfordshire, on 22 July and attempted to stop him.
Police were able to take scrapings from under her fingernails and found traces of tissue from Marvyn Mulvey.
On Friday, Mulvey, 40, was jailed for seven and a half years after admitting burglary at St Albans Crown Court.
Prosecutor Richard Jones told the court Ms Promonet had “made it her aim” to scratch Mulvey to obtain his DNA.
After the hearing, Ms Promonet said: “I thought I had to see his face, see if I could get his DNA, while all the time trying to memorise the clothes he was wearing.
“I didn’t have time to panic. Maybe if I’d had a few more seconds then I would have realised it was a dangerous thing to do.”
During the burglary, Mulvey used a wine bottle to beat Ms Promonet to the floor, leaving her with bruising to her body and head injuries.
She managed to hold on to her laptop, but Mulvey took a key to her flat and left.
He was later traced through his DNA and was arrested before pleading guilty to burglary and assault occasioning actual bodily harm.
Judge Graham Arran said Ms Promonet had showed a “very cool head” during the burglary.
“She did what was was necessary to bring this defendant to justice and showed enormous bravery in preventing him escaping from her flat,” he said.
Ms Promonet will be given an award of £350 out of public funds for her bravery at a crown court ceremony.
In a letter to the judge, Mulvey apologised and said: “What I have put her though, no one should have to go though.”