You can now read 10 articles in a month for free on BostonGlobe.com. Read as much as you want anywhere and anytime for just 99¢.

The Boston Globe

Nation

Ed Koch, former mayor of New York, dies

Former New York Mayor Ed Koch has died at the age of 88.

Jemal Countess/Getty Images

Former New York Mayor Ed Koch has died at the age of 88.

NEW YORK — Edward I. Koch, the master showman of City Hall, who parlayed shrewd political instincts and plenty of chutzpah into three tumultuous terms as mayor of New York with all the tenacity, zest and combativeness that personified his city of golden dreams, died Friday morning at age 88.

Koch’s spokesman, George Arzt, said the former mayor died at 2 a.m. from congestive heart failure. He was being treated at New York-Presbyterian Columbia Hospital.

Continue reading below

Koch had experienced coronary and other medical problems since leaving office in 1989. But he had been in relatively good health despite — or perhaps because of — his whirlwind life as a television judge, radio talk-show host, author, law partner, newspaper columnist, movie reviewer, professor, commercial pitchman and political gadfly.

Ebullient, flitting from broadcast studios to luncheon meetings and speaking engagements, popping up at show openings and news conferences, wherever the microphones were live and the cameras rolling, Koch, in his life after politics, seemed for all the world like the old campaigner, running flat out.

Only his bouts of illness slowed Koch down, most recently forcing him to miss the premiere of ‘‘Koch,’’ a documentary film that opens on Friday.

Mayor Michael R. Bloomberg praised Koch as ‘‘an irrepressible icon, our most charismatic cheerleader and champion,’’ calling him ‘‘a great mayor, a great man, and a great friend.’’

Koch’s 12-year mayoralty encompassed the fiscal austerity of the late 1970s and the racial conflicts and municipal corruption scandals of the 1980s, an era of almost continuous discord.

But out among the people or facing a news media circus City Hall, he was a feisty, slippery egoist who could not be pinned down by questioners and who could outtalk anybody in the authentic voice of New York: as opinionated as a Flatbush cabby, as loud as the scrums on 42nd Street, as pugnacious as a West Side reform Democrat mother.

‘‘I’m the sort of person who will never get ulcers,’’ the mayor — eyebrows devilishly up, grinning wickedly at his own wit — enlightened the reporters at his $475 rent-controlled apartment in Greenwich Village on Inauguration Day in 1978. ‘‘Why? Because I say exactly what I think. I’m the sort of person who might give other people ulcers.’’

His political odyssey took him from independent-minded liberal to pragmatic conservative, from street-corner hustings with a little band of reform Democrats in Greenwich Village to the pinnacle of power as New York City’s 105th mayor from Jan. 1, 1978, to Dec. 31, 1989. Along the way, he ousted the Tammany boss Carmine G. De Sapio and served two years as a councilman and nine more in Congress representing the East Side of Manhattan.

With his trademark — ‘‘How’m I doin?’’ — Koch stood at subway entrances on countless mornings wringing the hands and votes of constituents, who elected him 21 times in 26 years, with only three defeats: a forgettable 1962 state Assembly race; a memorable 1982 primary in a race for governor won by Mario M. Cuomo; and a last Koch hurrah, a Democratic primary in 1989 won by David N. Dinkins, who would be his one-term successor.

A MAYOR’S LEGACY

In retrospect, how did he do?

By the usual standards of measuring a former mayor’s legacy — the city he inherited, the challenges he faced, the resources available to meet those challenges and the extent to which his work endured beyond his term — historians and political experts generally give Koch mixed-to-good reviews.

Most important, he is credited with leading the city government back from near bankruptcy in the 1970s to prosperity in the 1980s. He also began one of the city’s most ambitious housing programs, which continued after he left office and eventually built or rehabilitated more than 200,000 housing units, revitalizing once-forlorn neighborhoods.

Politically, Koch’s move to the right of center was seen as a betrayal by some old liberal friends, but it gained him the middle class and three terms in City Hall. He was also the harbinger of a transformation in the way mayors are elected in New York, with candidates relying less on the old coalition of labor unions, minority leaders and Democratic clubhouses and more on heavy campaign spending and television to make direct appeals to a more independent-minded electorate.

In the end, however, he was overwhelmed by corruption scandals in his administration and by racial divisions that his critics contended he sometimes made worse.

Koch, for whom the headline ‘‘Hizzoner’’ seemed to have been coined, was a bachelor who lived for politics. Perhaps inevitably there were rumors, some promoted by his enemies, that he was gay. But no proof was offered, and, except for a single affirmation that he was heterosexual, he responded to the rumors with silence or a rebuke. ‘‘Whether I am straight or gay or bisexual is nobody’s business but mine,’’ he wrote in ‘‘Citizen Koch,’’ his 1992 autobiography.

Koch was New York’s most colorful mayor since Fiorello H. La Guardia. Tall, squinty-eyed, baldish, with a nimbus of gray and a U-shape smile more satanic than cherubic, Koch told a story like a raconteur in a deli, kvetching and ah-hahing with the timing of a Catskill comic. He loved to clown for photographers on the streets of New York, on a camel in Egypt or on a mechanized sweeper in China.

His image on television, his high-pitched voice on the radio, his round shoulders and gangly arms and baggy pants, and especially his streetwise gusts of candor — saying what people said over the dinner table in Queens, the Bronx and Brooklyn — gave New Yorkers the illusion that he was a rumpled, familiar acquaintance. But for all his self-promoting stream of consciousness, Koch was an intensely private man who revealed little about himself and had no patience for introspection.

Even at the small dinner parties he gave for close political associates and inner-circle friends, whether at Gracie Mansion or in his postmayoral apartment at 2 Fifth Ave., there were no real intimacies, participants recalled. The conversations were eclectic, a dance of politics, public affairs and Koch’s city of art and culture.

His first term, students of government say, was his best. Confronted with the deficits and the constraints of the city’s brush with bankruptcy in 1975, he held down spending, subdued the municipal unions, restored the city’s creditworthiness, revived a moribund capital budget, began work on long-neglected bridges and streets, cut antipoverty programs and tried to reduce the friction between Manhattan and the more tradition-minded other boroughs.

Re-elected in 1981 with a record 75 percent of the vote — he became the first mayor in the city’s history to get both the Democratic and the Republican nominations — Koch markedly improved the city’s finances in his second term. Helped by a surging local economy, state aid and rising tax revenues, the city government, with a $500 million surplus, hired workers back and restored many municipal services. He also made plans for major housing programs, improvements in education and efforts to reduce welfare dependency.

TROUBLED THIRD TERM

Koch, riding a huge crest of popularity, was elected in 1985 to a third term, with an amazing 78 percent of the vote. Only two other mayors in modern times, La Guardia and Robert F. Wagner Jr., had achieved third terms, and both found them to be quagmires.

For Koch, the storm clouds had already begun to gather.

Weeks after Koch’s inauguration, his ally Donald R. Manes, the Queens borough president, attempted suicide — he succeeded two months later — in a troubling prelude to one of the worst corruption scandals in city history.

What followed was a series of disclosures, indictments and convictions for bribery, extortion, perjury and conspiracy that touched various city agencies. Much of the skulduggery centered on the Transportation Department and the Parking Violations Bureau. Stanley M. Friedman and Meade H. Esposito — the Democratic bosses in the Bronx and Brooklyn, respectively, and Koch supporters — were convicted. Friedman went to prison, and Esposito, who was in ill health, received a suspended two-year sentence and a fine.

Anthony R. Ameruso, the transportation commissioner, was forced to resign, and the scandal snared businessmen, lawyers, parking meter attendants, sewer inspectors and others. Scores of convictions were obtained by the U.S. attorney in Manhattan, Rudolph W. Giuliani.

No one accused Koch of any wrongdoing. Most of the accused were not his appointees, and none were senior advisers; he had always kept a distance from his commissioners, letting them run their departments with relative independence.

Koch said that he was shocked, that he had been blindsided by subordinates and associates whose schemes he could not possibly have divined. He always said he had befriended Friedman, Esposito, Manes and others because they controlled votes that could make or break legislation he wanted approved or killed.

But critics said the old reformer had become too close to Democratic bosses in pursuit of his own ambitions, and accusations of complacency and cronyism dogged him for the rest of his tenure.

The scandals and the scourges of crack cocaine, homelessness and AIDS were compounded by a widening rift between Koch and black New Yorkers. The mayor traced his contentious relationship with black leaders to his first-term decision to close Sydenham Hospital in Harlem, where, he said, the city was paying too much for inadequate care. He would regret the decision.

‘‘It was the wrong thing to do,’’ Koch, who rarely second-guessed himself, said in 2009. Closing the hospital saved $9 million, he said, but he added: ‘‘There was such a psychological attachment to Sydenham, because black doctors couldn’t get into other hospitals. It was the psychological attachment that I violated.’’

Black leaders were also unhappy with Koch’s decision to purge antipoverty programs and comments he made that they considered insensitive. He said, for example, that busing and racial quotas had done more to divide the races than to achieve integration, and that Jews would be ‘‘crazy’’ to vote for the Rev. Jesse Jackson in his 1988 presidential campaign after Jackson’s 1984 reference to New York as ‘‘Hymietown’’ and his call for a Palestinian homeland in Israel.

In a city where minorities had long held grievances against a largely white police force, Koch’s 1983 appointment of Benjamin Ward as New York’s first black police commissioner hardly appeased critics, and a series of ugly episodes came to symbolize mounting racial troubles in the Koch era.

In 1984, a white officer with a shotgun killed a black woman, Eleanor Bumpurs, 66, as she was being evicted from her apartment in the Bronx; he was acquitted of all charges. In 1986, a gang of white teenagers assaulted three black men in Howard Beach, Queens, chasing one, Michael Griffith, to his death on a highway. And in August 1989, a black youth, Yusuf K. Hawkins, 16, who went to Bensonhurst, Brooklyn, to see a used car, was attacked by a group of white youths and shot dead.

The death of Hawkins came just a month before Koch faced Dinkins, the Manhattan borough president and the only black candidate, in the 1989 Democratic primary. By then, City Hall was lurching from crisis to crisis. The racial divisions, the corruption scandals, the failures to cope with crack and homelessness all contributed to a sense it was time for a change. Dinkins, pledging to bring the city together again in a ‘‘gorgeous mosaic,’’ narrowly defeated Koch in the primary and went on to beat Giuliani, who ran on the Republican and Liberal lines, by a slender margin in the general election.

‘‘I was defeated because of longevity, not because Yusuf Hawkins was murdered six weeks before the election, although that was a factor,’’ Koch wrote in an article in New York magazine. ‘‘People get tired of you. So they decided to throw me out. And so help me God, as the numbers were coming in, I said to myself, ‘I’m free at last.’’’

SON OF IMMIGRANTS

Edward Irving Koch was born in Crotona Park East in the Bronx on Dec. 12, 1924, the second of three children of Louis and Joyce Silpe Koch, Polish Jews who had immigrated to New York separately in the early 1900s. Louis was a furrier and a partner in a shop until it folded in the Depression in 1931.

The family then moved to Newark, sharing an apartment with Louis’s brother, who ran a catering business. At age 9, Edward, like his humbled father, began working for his uncle in a hat-and-coat-check concession. He later worked as a delicatessen clerk and went to South Side High School in Newark.

One day, when he was 13 and vacationing in the Catskills, he leapt into a lake, swam out and saved his sister, Pat, 6, from drowning. Though a B student, he was president of his school debating society. While his brother, Harold, was athletic, Edward pursued stamp collecting and photography.

After Edward’s graduation in 1941, the Koches, back on their feet in the fur business, moved to Ocean Parkway in Brooklyn. For the next two years, the young man went to City College in Manhattan and worked as a shoe salesman.

Edward Koch was drafted into the wartime Army in 1943 and earned two battle stars in Europe as an infantryman. After V-E Day, because he could speak German, he was sent to Bavaria to help remove Nazi public officials from their jobs and finding non-Nazis to take their place. He was a sergeant when discharged in 1946.

After the war, he moved back in with his parents but did not return to undergraduate studies. (City College awarded him a bachelor’s degree in 1981.) Instead, he went to law school at New York University. He received his law degree in 1948, was admitted to the bar in 1949 and over the next 20 years practiced law in New York City, becoming a founding partner of Koch, Lankenau, Schwartz & Kovner in 1963.

Koch began his life in politics in 1952 as a street-corner speaker for Adlai E. Stevenson, who lost the presidential election to Dwight D. Eisenhower. In 1956, already in his 30s, Koch moved out of his parents’ home, took an apartment in Greenwich Village and joined the Village Independent Democrats, a club opposed to De Sapio and the Manhattan Democratic organization known as Tammany Hall.

De Sapio, a power broker whose dark glasses gave him a sinister air, could make or break legislators, judges, even mayors. But as district leader in Greenwich Village, he had a narrow base. Koch ran for district leader in 1963 with the support of Wagner and upset De Sapio — a feat he repeated in 1964 and 1965 — ending the career of a Tammany boss. Heading a growing reform movement, Koch won a City Council seat in 1966 and befriended liberal causes, like antipoverty programs and rent controls.

By 1968, he was ready to move up. An opponent of the U.S. involvement in the Vietnam War and a supporter of Sen. Eugene J. McCarthy’s presidential candidacy, Koch, with Democratic and Liberal backing, upset Whitney North Seymour Jr. in what was called a classic American race — a son of immigrants versus the scion of a family rooted in national history — and became representative for the 17th Congressional District, the first Democrat to occupy the seat since 1934.

The seat, representing the affluent Upper East Side, parts of Midtown and Greenwich Village, was held by John V. Lindsay until he became mayor in 1966. Koch later represented the 18th District after a redistricting.

FROM CONGRESS TO CITY HALL

Koch, in Congress from 1969 to 1977, became known as a hard-working, independent liberal able to work with conservatives. He co-sponsored a law that gave citizens access to their government files and introduced legislation for a national commission on drug abuse. He supported public transportation and housing, Social Security and tax reform, home health care for the elderly, aid to Israel, amnesty for draft resisters, solar energy research, federal financing of abortions and consumer protection measures.

He was re-elected four times by majorities of 62 percent to 77 percent. In nine years in Congress, he stayed in Washington two weekends. He said he got ‘‘the bends’’ when outside New York too long. Every Thursday night, he went home for a weekend of campaigning and meeting constituents.

Still, he was almost unknown outside his district when he ran for mayor in 1977, facing seven candidates in the Democratic primary, including the incumbent, Abraham D. Beame; Mario Cuomo, then New York’s secretary of state; Reps. Herman Badillo and Bella S. Abzug; the Manhattan borough president, Percy E. Sutton; and Joel W. Hartnett, a businessman and civic watchdog.

But there was wide dissatisfaction with Beame’s handling of the fiscal crisis in 1975; Time magazine put him on the cover as a beggar with a tin cup. Many New Yorkers were also worried about rising crime and spending on social programs.

Koch benefited from support by The New York Post, but the crucial moves were made by him. In one master stroke, he hired the political consultant David Garth to engineer his campaign. Sensing the city’s drift to the right, Garth devised a more conservative image for Koch, a formidable task because the candidate had portrayed himself as a liberal, and he had no wife and children with whom to pose for the decorous voter.

To the rumors about his sexuality, his standard answer was that it was no one’s business but his own. Placards sprouted in the 1977 mayoral campaign saying, ‘‘Vote for Cuomo, Not the Homo.’’ Koch did not respond at the time, but 12 years later, in his book ‘‘His Eminence and Hizzoner,’’ he recalled, ‘‘When I first saw those posters, I cringed, and I wondered how I would be able to bear it.’’

Although Cuomo always disclaimed responsibility for the posters, Koch never forgave him, as he made clear with a pointedly disparaging reference to Cuomo in a recorded interview with The Times that was not to be made public until Koch’s death.

Asked on a WMCA radio show in 1989 about his sexuality, Koch declared, for the first and only time publicly, that he was heterosexual. ‘‘I happen to believe that there is nothing wrong with homosexuality,’’ he said. ‘‘It’s whatever God made you. It happens that I’m heterosexual, but I don’t care about that. I do care about protecting the rights of 10 percent of our population who are homosexual and who don’t have the ability to protect their rights.’’

Koch began appearing often in the 1977 race with his close friend and adviser Bess Myerson, a former Miss America and a popular former city commissioner of consumer affairs.

In the campaign, Koch attacked Beame’s ‘‘clubhouse politics’’ and proclaimed himself a ‘‘liberal with sanity’’ — a competent manager who would see the city right.

He made frequent campaign trips to the boroughs outside Manhattan, where he denounced welfare abuse, unconscionable demands by municipal unions and wasteful spending by city agencies. He vowed to crack down on crime, advocated the death penalty in some cases and promised to abolish the Board of Education as ‘‘a lard barrel of waste.’’

It worked. Koch received 20 percent of the primary vote to Cuomo’s 19 percent. Koch then won a runoff against Cuomo and went on to take the general election against state Sen. Roy M. Goodman, a Republican; Barry Farber, a Conservative; and Cuomo, who had the Liberal Party line and the dubious distinction of losing three times to Koch that autumn.

TACKLING FINANCIAL ILLS

Resigning his House seat, Koch took the reins of a city government that faced a deficit of $400 million, crumbling streets and bridges, heavy demands from labor leaders and a bond market that put city securities somewhere between unreliable and unsalable. Many businesses and middle-class residents were moving out of town, with concomitant losses in tax revenues and jobs.

The mayor rolled up his sleeves. After reaching a settlement with the unions, he scaled down the city budget, ordered the attrition of 10 percent of the city’s 200,000-member work force and, with Felix G. Rohatyn, the state’s monitor of city finances, revised a fiscal recovery plan that sought the aid of banks and the state and federal governments. Congress approved loan guarantees of $2 billion, enabling the city to get back into the bond markets, and the road to recovery was paved.

Koch cut city services and patronage-laden antipoverty programs. There were outcries from some black and Hispanic leaders that he was favoring the middle class, but he balanced the budget in his first term. He also issued an order prohibiting discrimination in city jobs on the basis of sexual orientation, and proposed laws to limit smoking in public places and to provide public financing of political campaigns.

But he had little success in taking back some of the power that had been diffused in previous administrations. He failed to gain control of the quasi-independent Health and Hospitals Corp. and the Board of Education. But he got his man, Frank J. Macchiarola, hired as schools chancellor, and his former deputy mayor — Robert F. Wagner Jr., son of former Mayor Wagner — named president of the school board.

After winning his second term, Koch ran for the Democratic nomination for governor. It was a mistake, compounded by campaign blunders, he conceded later. In an interview with Playboy magazine, he called suburbia ‘‘sterile’’ and rural America ‘‘a joke.’’ The comments provoked an uproar from insulted suburbanites and upstate residents whose votes he needed.

Cuomo, the lieutenant governor, won the primary and went on to become governor. ‘‘In the end,’’ Andy Logan wrote in The New Yorker, ‘‘the joke was on Koch.’’

He had always been frank, leaving himself open to charges of callousness. At various times he skewered and provoked the wrath of Jews and gentiles, business and union leaders, blacks and whites, feminists and male chauvinists. He vilified his Tammany foes as ‘‘crooks’’ and ‘‘moral lepers,’’ good-government panels as ‘‘elitists,’’ black and Hispanic leaders as ‘‘poverty pimps,’’ neighborhood protesters as ‘‘crazies’’ and Abzug as ‘‘wacko.’’

He was never a man of deep intellect or great vision, students of government and even his associates conceded. But, they said, he was more complex than his blurted assessments and gratuitous insults implied. Critics said he could be petty, self-righteous and a bully when his ideas or policies were attacked.

But associates and admirers, pressed to explain how the mayor could be so popular while reducing city services and apparently alienating so many groups, insisted that Koch had extraordinary political instincts and theatrical flair, and that his candor only reflected what many New Yorkers had long thought themselves.

It was one thing for a politician to offer excuses for litter, crime and poor transit service, as so many did. But it was another to say, as Koch did, ‘‘It stinks.’’ Over time, many New Yorkers, especially the middle class, came not only to accept his puckish candor but also to relish it.

The honeymoon lasted two terms. After the corruption scandals broke, however, the politics of candor paled, and critics said the mayor began to lose his touch, flip-flopping on issues as political winds shifted. He first sought more accountability from his commissioners, then softened; he first opposed, then supported immunity for those who confessed to bribing public officials.

Koch’s third-term agenda was ambitious: plans to improve education and to cut the welfare rolls, and a 10-year, $5.1 billion capital proposal to attack homelessness and the housing shortage by building or rehabilitating hundreds of thousands of units.

NOTABLE SUCCESS IN HOUSING

The housing plan, based on dozens of city financing and ownership programs, would become a notable and long-lasting success. It began with a stock of 10,000 properties abandoned by owners or seized by the city for tax delinquency.

By the end of the Koch administration, 3,000 apartments had been created in formerly vacant buildings, 13,000 more were under construction, and design work had begun on 20,000 more. In the next 15 years, over four mayoral administrations, 200,000 more units were built or restored, the number of vacant lots dropped sharply, and the original stock of 10,000 abandoned buildings was reduced to under 800.

But in Koch’s final years in office, his programs were all but overshadowed by scandals. As the mayor waffled, prosecutors charged that thousands of parking meter attendants and sewer, electrical and housing inspectors had taken graft. An avalanche of indictments and convictions ensued.

And the administration’s troubles multiplied: 50,000 homeless people crowded into shelters and roamed the streets and subways; there was a surge of crack-related crimes and growing outrage in minority communities over claims of police brutality.

Then, in 1987, the stock market collapsed, and even the prosperity that had sustained the city’s treasury and the mayor’s popularity began to flag. Koch had a mild stroke that August, and associates said he seemed for a time to lose heart.

By the end of his third term, Koch was tired. His original faith in government’s capacity to solve the problems of families and communities had been eroded; the old liberal had embraced the new creed of Reaganesque reliance on self-help, and it seemed that he had lost some of his old self-confidence.

‘‘It’s a big city; you don’t know how to get your arms around it, and government becomes the enemy,’’ he told Sam Roberts of The Times a few months before he left office. ‘‘Twelve years ago, if someone attacked me, I wouldn’t let them get away with it. I’d take them on. I now perceive my job to include allowing people to vent their rage.’’

After leaving office, Koch gave up his rent-controlled flat for a two-bedroom apartment on lower Fifth Avenue, but he gave no thought to retiring. Instead, he became a one-man media show, with forums on television and radio and in newspapers, magazines and books, besides being a lawyer, endorsing commercial products, lecturing and teaching. He earned more than $1.5 million a year.

Koch had occasional medical problems. He suffered what doctors called a moderate heart attack in 1999, and in 2009 he underwent quadruple bypass surgery and replacement of his aortic valve. He had worn a pacemaker since collapsing with an irregular heartbeat in 1991. There were subsequent hospitalizations for various ailments.

On March 22, 1999, he was briefly hospitalized with low blood pressure hours before he was to be arrested with scores of others in protests organized by a onetime foe, the Rev. Al Sharpton, over the police shooting of Amadou Diallo, an unarmed immigrant from Guinea. Getting himself arrested for a cause raised only a few eyebrows; Koch, almost a decade out of office, still wanted to march at the head of the parade.

In 2008, approaching 84, he was still pitching — endorsing Barack Obama for president, shaking the hand of the visiting Pope Benedict XVI, even generating publicity with his own burial plans. ‘‘Koch, Resolved to Spend Eternity in Manhattan, Buys a Cemetery Plot,’’ a headline in The Times declared.

In 2010, Koch took on his most ambitious fight in years, leading a coalition, New York Uprising, against what he called ‘‘a dysfunctional Legislature’’ in Albany. He traveled the state on a mission to shame lawmakers who failed to sign a pledge to promote reforms.

‘‘Throw the bums out!’’ he shouted in Buffalo. ‘‘You’re either on the side of angels or you’re a bum. And if the angels betray their pledges, I’m going to run around the state screaming, ‘Liar, liar, pants on fire!’’’

At various times he wrote columns for The Post, The Daily News, the online magazine Jewish World Review and the right-wing Web site NewsMax.com. He also wrote movie and restaurant reviews for local weeklies.

He made regular appearances on WCBS-TV, had talk shows on Fox television and on WNEW and WABC radio, teamed with former Senator Alfonse M. D’Amato for a Bloomberg Radio program and was a frequent commentator on the local news television station NY1.

His remarks often sounded like pronouncements by an officeholder, proposing policy changes and oozing invective for political opponents and journalistic rivals. Koch denied he was wreaking vengeance on old foes, but, as he told New York magazine, ‘‘It’s a lot more fun being a critic than being the one criticized.’’

INFLUENCE OUT OF OFFICE

Out of office, Koch remained influential in New York politics. He crossed party lines to support Giuliani in the 1993 mayoral election, an endorsement crucial to Dinkins’ defeat. But Koch later turned against Giuliani, flaying him as ‘‘a good mayor but a terrible person’’ and refusing to endorse him for a second term.

Koch endorsed Bloomberg’s successful races for mayor as a Republican in 2001 and 2005, calling him about ‘‘as Republican as I am.’’ (Bloomberg later refashioned himself as an independent.) And when Bloomberg engineered a legislative finesse of term-limits laws to run for a third term in 2009, Koch backed him and called for an end to term limits.

In presidential races, Koch went back and forth. He supported the losing Democratic ticket of Al Gore and Joseph I. Lieberman in 2000, but joined the Bush-Cheney re-election bandwagon in 2004 and promoted the Republican National Convention in New York, urging New Yorkers to ‘‘make nice’’ to conventioneers. By 2008, he was back with the Democrats, supporting Hillary Rodham Clinton’s bid for the nomination and, when she lost, switching to Obama.

Koch’s only official work in recent years was a 2007 appointment to a panel examining the state comptroller’s office in the wake of a scandal that forced Comptroller Alan G. Hevesi to resign.

Koch appeared, mostly as himself, in a score of movies, including ‘‘The Muppets Take Manhattan’’ and ‘‘The First Wives Club,’’ and in cameo roles on television shows, including ‘‘Sex and the City.’’ He made commercials for Coca-Cola, Snapple, FreshDirect and Ultra Slim-Fast — which he said helped him lose 30 pounds in a year, though he later regained the weight.

And he was the star, of course, of ‘‘Koch,’’ the documentary film by Neil Barsky that had its premiere on Tuesday night at the Museum of Modern Art, drawing New York politicians. Koch was forced to miss the event because of his hospitalization.

For years Koch worked out with a personal trainer almost every morning at a gym. He became a partner with Robinson, Silverman, Pearce, Aronsohn & Berman, which in a 2002 merger became Bryan Cave, an international law firm and one of the largest real estate practices in New York. He provided advice and brought in many clients.

He became an adjunct professor at New York University, Brandeis University and Baruch College of the City University of New York, and gave lectures across the country and abroad, with minimum fees of $20,000 for off-the-cuff talks on race relations, drugs, anti-Semitism or ‘‘Koch on the City,’’ ‘’Koch on the State’’ or ‘‘Koch on Everything.’’

From 1997 to 1999, he was the judge on the nationally syndicated show ‘‘The People’s Court,’’ hearing small claims and ribald testimony like that of a man who claimed he suffered whiplash from a topless dancer’s breasts. Koch was done in by the competing ‘‘Judge Judy’’ — Judith A. Sheindlin, a retired New York City Family Court judge — and was replaced by her husband, Gerald Sheindlin, a retired State Supreme Court justice. Koch had appointed both to the bench.

He continued to write books — 17 in all — murder mysteries and commentaries on politics, rivals and other subjects. Most were a blend of his insights, experiences and observations with co-authors providing the workaday prose. While in office, he produced ‘‘Mayor’’ (1984), ‘‘Politics’’ (1985) and ‘‘His Eminence and Hizzoner’’ (1989).

Later came ‘‘All the Best: Letters From a Feisty Mayor’’ (1990), ‘‘Ed Koch on Everything’’ (1994), ‘‘I’m Not Done Yet’’ (2000) and ‘‘Buzz: How to Create It and Win With It’’ (2007).

Koch and his sister, Pat Koch Thaler, wrote a small volume, ‘‘Eddie: Harold’s Little Brother,’’ a children’s book that appeared in 2004. His brother, Harold M. Koch, a carpet distributor, died in 1995. Besides his sister, a former dean at New York University whom he saw regularly in later years, Koch is survived by New York itself, as an old friend put it a few years ago.

‘‘The city was and is his family,’’ said Maureen Connelly, a former press secretary and veteran political adviser. ‘‘We used to be scared about what would happen to Ed if he lost. We said it would be best if he just died in the saddle. But he never had any intention of getting off the horse.’’

You have reached the limit of 10 free articles in a month

Stay informed with unlimited access to Boston’s trusted news source.

  • High-quality journalism from the region’s largest newsroom
  • Convenient access across all of your devices
  • Today’s Headlines daily newsletter
  • Subscriber-only access to exclusive offers, events, contests, eBooks, and more
  • Less than 25¢ a week