Ed Koch

In this Sept. 7, 1981 file photo, New York City Mayor Ed Koch, center, gestures as he marches in a Labor Day parade down New York's Fifth Avenue. (Associated Press / December 16, 2014)

In the late 1970s when Edward I. Koch won his first term as mayor of New York, the city was in shambles, its coffers and confidence sapped by financial crises and a paralyzing blackout. It needed a fighter and found one in Koch, a well-practiced pol with the determination — and bite — of a bulldog.

He steered the city out of bankruptcy and restored its swagger, a one-man cheerleading squad who personified the witty and feisty New Yorker.

The three-term mayor of New York and perennial civic combatant, who rallied and riled the city in and out of office with his tenacious style and irrepressible opinions, died Friday of congestive heart failure at New York-Presbyterian/Columbia Hospital, said his friend and spokesman George Arzt. He was 88.

Koch had been hospitalized Monday, a day before a documentary about him, "Koch," premiered in New York City. He had been hospitalized several times in recent months for breathing problems and other ailments.

For most of his adult life, Koch had lived alone in an apartment off Washington Square Park in Greenwich Village. It was where he departed the morning in 1978 when he rode a public bus to City Hall to be sworn in as the city's 105th mayor and where he returned 12 years later, after a disastrous fourth run to keep the job he clearly relished and worked hard at. He spent the rest of his life out of public office but rarely out of public view.

He juggled almost a dozen jobs — including law partner, columnist, author, radio show host, playwright, movie reviewer and lecturer — and appeared relentlessly in the media, a shtick-artist with one of the most recognizable New York accents in the world. When he wasn't bellowing at opponents on political round tables, he was hawking such products as diet aids and soft drinks in advertisements and popping up in screen cameos as himself, the quintessential New Yorker, alongside Carrie and the girls in television episodes of "Sex and the City" or with Big Bird in the 1984 film "The Muppets Take Manhattan."

His support was pivotal in Republican Bob Turner's victory in the September 2011 special election in the heavily Democratic congressional district that had been represented by Rep. Anthony Weiner, who was forced to resign in a "sexting" scandal. "Ed Koch was enough to turn this around," Democratic strategist Hank Sheinkopf said after Turner's win.

For his 86th birthday in 2010, New York's current mayor, Michael Bloomberg, renamed the bridge linking Manhattan to Koch's home borough of Queens the Ed Koch Queensboro Bridge, saying it was, like Koch, "a resilient, hard-working New York City icon."

"He was a great mayor, a great man, and a great friend," Bloomberg said Friday in a statement. "In elected office and as a private citizen, he was our most tireless, fearless and guileless civic crusader. Through his tough, determined leadership and responsible fiscal stewardship, Ed helped lift the city out of its darkest days and set it on course for an incredible comeback."

New York Gov. Andrew Cuomo echoed the sentiment: "No New Yorker has — or likely ever will — voice their love for New York City in such a passionate and outspoken manner than Ed Koch."

"He was the epitome of New York — loud, funny, opinionated, smart," said Arzt, who was Koch's City Hall spokesman and part of an administration alumni group that lunched with him every Saturday after he left office. "Ed was very much a straight-shooter, a champion of the middle class, a moderate Democrat akin to a Harry Truman. He defied categories."

In fact, Koch loved to enrage liberals by doing and saying the unthinkable — endorsing Republican politicians such Rudolph Giuliani and George W. Bush. But Koch also held fast to many liberal values. One of his first executive orders as mayor was adding sexual preference to a citywide ban on job discrimination.

He invited controversy and enjoyed confrontation. He once wrestled an egg-throwing heckler to the floor before the police could move in.

Altogether, Koch wrote or co-authored 17 books, including eight autobiographies, two children's books and multiple mystery novels starring himself as the detective.

Koch opined freely, never mincing words: Movie tickets were too expensive; the United Nations, after an anti-Israel vote, was "made up of gangsters, cutthroats and piranhas"; a Puerto Rican mayoral rival was a "poverty pimp"; Sarah Palin was likable but "scares the hell out of me." He never lost interest in his favorite subject — himself. "How'm I doin'?" was his trademark question.

The only topics that remained off limits were his heroic service as an infantryman in World War II — he was awarded two battle stars — and his sexuality. A lifelong bachelor, he was dogged by questions about his sexuality, which he largely ignored, although he did on two occasions describe himself as heterosexual. "I ran in a total of 24 elections and won 21," he once told the New York Times. "I will not be a coward and say I am straight or I'm gay, because it's no one's business. I got where I am today not because of sexuality or gender but because people thought I was the best at what I did...."

In recent years, Koch appeared to mellow, seeking reconciliation with former rivals, but he refused to yield when it came to standards for public service. As recently as the summer of 2010, the octogenarian ginned up a campaign called "New York Uprising" to reform state government. Despite a history of heart disease that left him with two pacemakers and a degenerative spinal disorder that caused the once-strapping 6-foot-1 former mayor to be stooped in old age, he embarked in a Jeep on a campaign-style press tour around upstate New York to shame reluctant legislators in their home districts into signing a pledge to "clean up Albany."

This was shortly after Koch, ever the showman, revealed he had finalized plans for his funeral and penned his epitaph. His gravestone will declare his pride in his religion — "My father is Jewish, my mother is Jewish, I am Jewish" — and his "fierce" love of his city and country.

Edward Irving Koch was born Dec. 12, 1924, in the Bronx and spent his early years in Newark, N.J., where his family moved after his furrier father went broke during the Great Depression. Koch attended the City College of New York before being drafted into the Army; he eventually graduated from New York University's law school and joined a liberal political reform group in Greenwich Village, the Village Independent Democrats. He served as a district leader, city councilman and for 10 years represented the East Side and lower Manhattan in Congress.

The second of three children, Koch is survived by his sister, Pat Koch Thaler. A brother, Harold, died in 1995.