MADRID — The Spanish city of Cádiz will undertake what some may see as a Sisyphean task: relocating 5,000 pigeons hundreds of miles away after a complaint that the birds are driving away tourists from the terraces of cafes in the most visited part of the southern port city.

Carrier pigeons probably date back to ancient Persia. But under a plan announced last month by Cádiz officials, the pigeons themselves will be carried: They will be captured and transported next year to a thinly populated countryside location in eastern Spain. There, they will find a new home in a dovecote near the town of Ribarroja del Turia.

The exile solution to pigeon overcrowding is being presented as a more animal-friendly approach than that taken in other places, where pigeons are treated like flying rats to be culled or fed contraceptive pills that may also be consumed by other species.

The city will use “the most respectful and sustainable method” to keep its pigeon population under control, Álvaro de la Fuente, the city official in charge of environmental policy, said in a statement.