New tracking technology is being used in the battle against sheep rustlers targeting Scotland's farms.
Sheep theft used to be an opportunistic small-scale problem, but thousands of animals are now being stolen every year by organised criminal gangs.
It is estimated rustling in Scotland has cost farmers more than £200,000 over the last two years.
Now special coded fleece paint and tracing equipment that is swallowed can help identify stolen sheep.
The new technology is far harder for criminals to get around than more traditional tags and colour markings.
PC Willie Johnston, from Police Scotland's Rural Crime Unit, said the new paint features coded microdots on the fleece and skin that can be traced to farms.
He said of the new paint technology: "It's an overt and a covert means of marking them, security marking them, so it's easy for us to identify them when we recover them."
When the thieves steal sheep they can cut the ear tags out and replace them with their own.
An electronic identification device (EID) device can be swallowed by a sheep and lies in its rumen.
PC Johnston said: "You're always going to get a hit on the real identity because it's lying inside the animal."
He said livestock is stolen to breed from as well as simply for meat.
He explained: "We've had instances of good pedigree livestock getting stolen, and you're also getting just normal run-of-the-mill commercial animals just getting taken.
"What you have to remember is they're getting these animals for nothing so they're not bothered what they do with them."
The thieves often target isolated hillside areas, making their crimes harder to detect.
The thefts deprive farmers not only of valuable stock, but bloodlines that have taken years to establish.
Upper Kidston near Peebles is a typical hill farm, and one of the many that has been targeted by criminal gangs.
Hugh Stewart has farmed there all his life, but in the past decade he and his cheviot and blackface flock have fallen victim to a spate of thefts.
Mr Stewart said about 1,300 of his sheep had been stolen over recent years.
He said: "It started about eight years ago, I lost quite a few then. It would be the last three years out of four, we've lost about two hundred each year."
Describing the financial impact, Mr Stewart said: "We've made losses every year for about the last five years."
The farmer explained: "We've been breeding stock up here 40 or 50 years and all the best sheep's disappearing, so it's really your lives work gone down the drain isn't it?"
Mr Stewart said he'd suffered a stroke, and had quite often considered throwing in the towel.
He said: "It's been pretty grim this last four or five years aye - ken it keep you awake sometimes, well just about every night really.
"A lot of folk reckon that it's what caused my stroke."
Livestock rustling is estimated to have cost the UK rural economy £2.5m last year, up nearly 14% since 2016.
You can see this story on Landward on BBC One Scotland on Friday at 19:00, as well as on the iPlayer.