For centuries libraries have been a vital resource, a symbol of knowledge, and an epicenter of culture throughout the world.

There is no doubt that the libraries themselves are monumentally important buildings, an array of stunning architecture which often stand as monuments to different eras and have the power to transport us back to one.

Caring for the libraries’ collections within these often historical buildings is key. In order to keep the books in good condition and preserve them for the future generations, books need to be handled and stored with care. Considering the fact that books from the past centuries, especially from the 19th century, have a high acidic content and can be easily discolored, libraries need to create the right conditions to prevent this kind of damage.

Lighting, temperature, and relative humidity in libraries are the three factors that can cause damage if the collections are not stored properly. It is very important for books to be kept away from direct sunlight as it can cause some serious damage. Variations of temperature and humidity in the libraries are also a threat and that is why libraries make serious efforts to achieve a constant state of these two conditions.

Among the most serious threats to library materials are pests. Libraries use various methods to deal with insects, including ethylene oxide, methyl bromide, gamma radiation, and bats. Yes, you read that correctly. Bats. It is not a common means of controlling the pests, but the library at Mafra National Palace in Portugal is an uncommon place.

Located about 25 miles north of Lisbon is the town of Mafra, known for its largest building: the Mafra National Palace. King João V is credited with the construction of this stunning building, today considered the most important baroque monument in Portugal.

This architectural marvel is so much more than just a palace as it is one of the biggest buildings constructed during the 18th century in Europe.

In 1711, King João V vowed to build the Mafra National Palace if his wife Maria Ana of Austria gave him children, and she did. It was December 4, 1711, when his first daughter, the Infanta Barbara of Portugal, was born and hence, construction of this colossal palace began.

The complex covers about 430,556 square feet, including more than 1,200 rooms, 5,000 doors and windows, and 156 stairways. These quite impressive numbers required a workforce to match them and it is said that at one point during construction, around 45,000 men were working on it.

The largest room in the palace is occupied by the splendid baroque library, which houses around 40,000 volumes, including some printed before the year 1500.

Situated at the back of the second floor of the palace is the library which is 278 feet long and 31 feet wide. Its stunning collection of rare books, magnificent marble floor, wooden bookshelves, and balcony with a wooden railing make this library one of the most significant Enlightenment-era libraries in Europe.

However, what makes this library even more intriguing is the staff’s choice to preserve the book collection with a colony of bats.

No one knows exactly how long the bats have been protecting the rare books at the library, but some say it is since 1711. Reportedly, there are about 500 small bats, about an inch long, that are kept in boxes during the day and let out at night to do their job.

Their target is the Silverfish found living in the library and they are considered the biggest threat to the books as their favorite food includes book bindings and paper amongst other things. Luckily, for the bats and for the library, Silverfish are their favorite food.

Related story from us: Yale’s rare book library is designed to shield precious works from direct sunlight

The only problem for the people working in the library is that they have to clean bat scat from the entire library every morning, but they consider it worth doing to keep the precious books safe and preserved for the generations to come.