A burglar who used a toilet in a house he broke into was caught by DNA evidence in a hair he left behind on the seat.
South Wales Police found the hair at the property in Cymmer near Port Talbot and ran it through a database.
It led them to 21-year-old Lee Hanbury, who lives in the village.
He was sentenced to eight months in jail at Swansea Crown Court for stealing computer games, DVDs and other items from the house.
The court heard Hanbury broke into the house in Gwynedd Avenue in July.
Det Insp Dave Hough of Neath Port Talbot CID said: "Entry was gained to the house after the rear door was forced open and an untidy search of all rooms on both the ground and first floor was made."
He said the burglar had used the toilet before leaving.
"An exact match against the profile of Lee Hanbury was obtained using the National DNA Database and he was subsequently charged with the burglary of this house."
Det Insp Hough said DNA techniques had helped the force cut burglaries in the area.
"House burglary is a very distressing crime for the victim and our success has been due to our pursuit of individuals who we suspect of being involved in criminality," he added.
"Traditionally, fingerprint evidence has been used to identify burglars but the advancement of DNA technology gives us another weapon to fight this sort of crime."