Stag beetles' love of ginger could be a key ingredient in the effort to conserve Britain's largest known terrestrial beetle, a study suggests.
Researchers found that ginger-baited traps would lure the insects, allowing scientists to get an accurate picture of the beetles' abundance in an area.
Ginger contains large amounts of alpha copaene, a chemical that is known to attract a range of insect species.
The findings appear in the journal Insect Conservation and Diversity.
Co-author Deborah Harvey from Royal Holloway, University of London, said she decided to carry out the research because stag beetles were listed as a priority species under the UK Biodiversity Action Plan (Bap). As a result, there was a legal requirement to monitor the species' numbers.
"In order to do this, you have to find out about its biology. Despite it being our biggest terrestrial beetle, not a lot was known about what attracted it, etc," she told BBC News.
"So, my remit was to devise a scheme that you could use to trap the beetle."
The discovery that ginger would be an effective lure was the result of a bit of good fortune.
After taking a number of samples from adult stag beetles and larvae, Dr Harvey identified the chemicals that attracted the insects.
However, she explained: "But most stag beetles are found in gardens, so if you are going to have a monitoring scheme you need something that is safe because you cannot have a dangerous chemical in the garden if children are about.
"So on one rainy afternoon, I was bored and was looking for something that contained the chemicals I had identified.
"I found three things: mango, avocado and ginger.
"I had some ginger powder in the house, so I tried it with the larvae. They were very attracted to it, they were rolling in it.
"The next step was to try it with the adults, and they were equally attracted to it - so I had found a safe lure."
She added that mango and avocado also worked, "but they are most expensive and go off more quickly".
Another challenge facing researchers trying to measure the abundance of stag beetles was that the animals spend up to six years underground before emerging as adults.
"If you are missing that six-year period then you have no idea how successful [the species] is [in an area]," Dr Harvey said.
"The only way there was to do it was to dig up stumps but, of course, then you would have completely disrupted the habitat.
So she teamed up with fellow co-author Dr David Chesmore, from the University of York, who had done a lot of work on acoustics.
"He said it would be a good idea to try and listen to the beetle larvae stridulating and record it."
Stridulation is believed to be a form of communication between larvae, and is generated by an individual rubbing its second and third legs together.
After recording the stag beetles' stridulation and bite patterns, the team compared it with the signals produced by other species, such as the lesser stag beetle and rose chafer beetle, which were likely to be found in similar habitats.
"Very luckily for us, there was a definite difference in the stridulation and bite patterns," Dr Harvey recalled.
"With the two signals, you can be pretty sure - without touching a garden fork - if stag beetles are present or not.
"Our new method offers genuine promise for monitoring the population of this elusive and rare insect, one that is declining across much of its European range.
"We need to know where the stag beetle lives, and in what numbers, to be able to conserve it effectively."
Dr Harvey suggested that the team's findings could have a much wider application.
"It can be used for any saproxylic species - any insects or beetles that live within wood because they all make different sounds."