Filming for “Koch,” a documentary about former New York mayor Ed Koch, began in 2010; he died last month as the film opened. (Image courtesy of Zeitgeist Films)

A new documentary about Ed Koch opens with footage of the three-term New York City mayor, who died last month, reminiscing about looking out the window of an airplane once, as he returned to the Big Apple from a trip. “There was the city of New York, laid out before me,” he says. “I thought to myself, ‘This belongs to me.’ ”

It’s a telling remark. On the one hand, it speaks volumes about the guy’s outsize ego. (“How’m I doing?” was Koch’s stock campaign greeting.) On the other hand, it tips you off that “Koch” might be as much a history of New York — from the fiscal insolvency of the late 1970s to the end of the booming 1980s — as it is a portrait of a man. Like the city, Koch comes across here as brash, contradictory, almost endlessly fascinating and a bit sad.

The movie will appeal to anyone who lived in — or followed — New York through the ’80s, but not exclusively to them. It’s ultimately a tale of humanity, not power.

Intercut with several decades of archival footage and photos and fresh interviews with politicians, journalists and former staffers are 2010 interviews with Koch himself as he is driven around the city or as he putters around his surprisingly modest apartment. He shows off his myriad medications for the camera, makes coffee and toast, and talks, with refreshing candor, about his accomplishments and regrets. Despite the economic necessity of closing Sydenham Hospital, for example, the 1980 action is remembered as a public relations disaster because of the symbolism it represented for the largely African American community it served.

Of course, Koch angered many other constituencies, too. Many gays were infuriated by his perceived failure to respond decisively to the AIDS crisis, a hesi­ta­tion some attributed to Koch’s allegedly closeted homosexuality. Filmmaker Neil Barsky asks him, point blank, about the rumors, which dogged the confirmed bachelor for decades. The response is vintage Koch: “It’s none of your [expletive] business.”

For the most part, though, Koch comes across as warm and unguarded. Socially liberal and fiscally conservative, eager to be liked but unafraid to tell people no, clean but tainted by friendships with the corrupt, the subject of “Koch” isn’t so much hard to get a handle on as he is a Rubik’s Cube of many moving parts.

After opening with Koch’s grandiose comment, the film cuts to footage of city legislators debating in 2010 whether to rename the Queensboro Bridge in honor of the former mayor. Although some speakers still hold onto resentment about Koch, decades after he left office, it’s also telling that, as we learn near the film’s conclusion, the legislation ultimately passed.

Koch got his bridge, and the film makes us understand why.

Unrated. At the Avalon Theatre. Contains some crude language. 95 minutes.