At the University of Coimbra in central Portugal, there are bats in the biblioteca. They swoop through the stacks, winging over a first-edition of Dionysius of Halicarnassus’s "Roman Antiquities" and past a 15th-century book of hours and Homer's "Opera Omnia" — snapping up bugs as they go.

It’s one of two 18th-century Portuguese libraries where bats are welcome guests, allowed to stay for the bug-eating — and, by extension, manuscript-preserving — services they provide. And visitors to Portugal can see them for themselves.

In Coimbra, a colony of Common pipistrelle bats makes their home behind the bookshelves of the university’s Joanina Library, emerging at nightfall to consume flies and gnats and other pests before swooping out the library windows and across the hilltop college town in search of water. The service they provide is indispensable: They eat insects in the library that might otherwise feed on manuscript pages.

Whether the flittermice took up residence here 300 years ago, when the library was built, or more recently is unknown. Librarians do know they’ve been here since at least the 19th century; they still use fabric made from animal skin, imported from Imperial Russia, to cover the original 18th-century tables, protecting them from scat left by the library’s flying residents. And every morning, just as their forebears did, the librarians remove the skins and clean the library floors.

Want to see the bats for yourself? The best chance at glimpsing them in action comes at nightfall: Stand on the steps just outside the library’s dense teakwood door, and wait for them to emerge and wing their way across the cobbled town square and into the hills.

You can also try visiting the library on a rainy day, when the chirps and squawks of bats will often resonate from deep within the stacks. Librarians say they often hear the bats “singing” — emitting social vocalizations — late in the afternoon on drizzly days.

Some 125 miles to the south, just northwest of Lisbon, another colony of indoor-outdoor bats is in residence at the 300-year-old Library at the National Palace of Mafra. Dating this colony is also difficult, but Hugo Rebelo, a bat biologist at the Center for Research on Biodiversity and Genetic Resources of the University of Porto, imagines some have been here for centuries. He has spent time recording this colony — comprised largely of grey long-eared bats as well as some serotine bats — as they forage among the stacks.

Come nightfall, they swoop among the monastic-royal library’s collection of incunabula (books printed prior to 1501 A.D.) — which includes a copy of the "Nuremberg Chronicle" — and other notable works like the first "Encyclopédie" of Diderot et D'Alembert.

Catching a glimpse of the bats here can also be difficult. The library closes before nightfall, which is when the winged creatures make their nightly migration between the stacks and the palace’s gardens. But the library pays tribute with a small glass case showcasing the taxidermied remains of three former winged residents.

Even when the bats aren’t showing off, the library is worth on a visit for its sheer magnificence. Some 36,000 books line the shelves of this Rococo-style, Enlightenment-era library — considered among Europe’s most important — which occupies a cross-shaped footprint on the eastern edge of Mafra bookending the downtown square.

The floors are covered in rose, white, and grey marble tiles, and the stacks are filled with ancient manuscripts. If the library looks familiar, that may be because it served as the Lilliputian Great Chamber of War in the 1996 film version of "Gulliver’s Travels."

And there’s nary a bug in sight.

Other articles from Travel + Leisure: