A small town outside Barcelona is using wolf urine to deter wild boar that have been coming in from the surrounding countryside.

After trying a variety of deterrents, the town council of Aiguafreda has agreed, in association with the local hunters’ association, to see if the smell of the pheromones of the wild pigs’ principal predator will keep them at bay.

At least 10 boars have been sighted in the town recently. “There’s not much food in the woods because it hasn’t rained, so they come into town looking for food,” Albert Alexandre Temprado, a local hunter, told El País.

While boar numbers in the countryside can be controlled by hunters, this isn’t a viable option in populated areas. Earlier this year the town tried using polyurethane to deter them, but the effect wore off within a few days.

The council has created a perimeter of powdered wolf urine around the town, a method it insists is environmentally friendly and has no effect on domestic dogs. Temprado admitted that it remained to be seen whether it was effective.

Meanwhile, local authorities have warned people not to approach the boars, as they can become aggressive, or to leave food out for them. They also advise that they should keep rubbish containers closed to stop the animals from foraging.

The boar are an invasive species and extremely adaptable. They have increasingly encroached on urban areas, much as foxes have in British cities.

Research by the University of Barcelona suggests that some wild boar are even passing up on natural sources of food found in the woods in favour of foraging among rubbish.

In recent years, groups of the animals have regularly been sighted in Barcelona, especially in neighbourhoods close to their natural habitat in the wooded Collserola hills to the west of the city. They have also been spotted close to the city centre.

The boars carry disease and also cause numerous road accidents. Barcelona has employed a variety of methods to control numbers, among them targeting females of breeding age.

In 2017 the city launched an experimental campaign of sterilisation using a vaccine. The technique has already been used in Britain and the United States. Early reports suggested that the vaccine had reduced the local Barcelona population by around 400.