When Frederick Wiseman set out to make “Ex Libris — The New York Public Library,” he didn’t think he was making a political statement.

But then came the election of Donald Trump, a president who has said he doesn’t have time to read and whose administration has proposed cuts to the humanities.

“The film is, inadvertently, a response to Trump,” Wiseman, 87, told amNewYork recently at the library’s main branch on Fifth Avenue. “He wasn’t president when I made it. I had just finished the editing a couple weeks after the election, but in fact the film represents, in my point of view, everything that Trump isn’t.”

Wiseman, perhaps the premier icon in documentary filmmaking today thanks to his 60 years of work chronicling the fundamental staples of American life in movies such as “High School” and “Ballet,” hails the “democratic” nature of the library system.

“It’s about so much more than lending books. Lending books is sort of a passive role. All the programs, the hundreds of courses and programs and after school classes that are run by the library, serving the poor and immigrant community of New York, is completely contrary to everything Trump represents,” he says.

Running more three hours and playing at Film Forum, the movie takes an expansive look at the system, which consists of four research centers and 88 branches in Manhattan, the Bronx and Staten Island. It’s made in Wiseman’s classic form, observing the institution at work and deriving meaning and power from the everyday scenes that define it.

“I had the deep thought that a library might make a good movie,” Wiseman says when asked what spoke to him about the subject before November 2016. “And I had no idea before I started about the depth and range of the programs offered by the library. I found out as soon as I came to visit, but my experience with libraries prior to that was very dated.”

The movie continues the career-long connection between Wiseman, who lives in Cambridge, Massachusetts, and New York City. His last film, “In Jackson Heights,” presented a comprehensive portrait of a neighborhood that in many respects symbolizes this diverse metropolis. He’s had 12 of his films premiere at Film Forum, more than any other filmmaker.

“There’s so much going on here,” he says when asked what keeps bringing him back. “So many interesting people live here, so many different things are being tried. Because of the population, the theater, the movies, the dance, the painting, the large universities, the student population, the wide variety of ethnic groups. There’s a lot going on. It’s interesting.”