Edward Irving Koch, the mayor who steered New York City out of a desperate fiscal crisis and forged a new, middle class governing coalition, died of congestive heart failure Friday morning at Columbia Presbyterian Hospital, his spokesman told the Associated Press. He was 88.

Koch, New York City’s dominant political figure of the 1980s and the architect of what remains its governing political coalition, stayed politically relevant through his long political twilight, courted aggressively by figures including Presidents George W. Bush and Barack Obama for his role as a proxy for pro-Israel Democrats willing, but not eager, to cross party lines.

But Koch’s later years of quips, movie reviews, and presidential politics remain secondary to his central legacy, which is in New York’s City Hall. Tall and gangly with a domed, bald head and a knowing smile, Koch was New York’s mayor and its mascot from 1978 to 1989. Through three terms, he repeated one question like a mantra: “How’m I doing?” At first, the answer was clear to observers who had watched the city slide toward bankruptcy: exceptionally well. Koch managed New York back from the brink, drove hard bargains with municipal unions, cut jobs where he had to and reduced taxes where he could. He presided over a boom in Manhattan, and spent his new revenues on renewing the south Bronx.

But as the Koch administration moved its third term, the mayor lost his momentum. As Wall Street boomed in the 1980s, Koch took advantage of the new revenues to double New York City’s budget and offer tax breaks to real estate developers. But the largesse couldn’t buy him friends: he clashed with black leaders and his old allies among Manhattan’s liberal democrats. New York became famous for its racial tensions and rising crime. He courted the Democratic Party bosses of Queens and the Bronx only to be tarnished by the corruption scandals that surrounded them.

“Koch had a very good first term and helped pull the city out of its doldrums, and he had a certain sense of the excesses of liberalism,” Cooper Union history professor Fred Siegel said. As time wore on, however, “he had no vision of how to run the city,” Mr. Siegel said.

Koch himself put it differently. “I consider myself to be a liberal with sanity,” he told the New York Sun (for which this obituary was written, and which ceased print publication four years before his death) during an interview at his midtown office in 2002.

While Mayor Koch’s vision may not have been apparent to all, the real drama of his career was that his political journey away from his base in Greenwich Village reform Democratic politics and into the arms of middle class, mostly white, Catholic voters in the outer boroughs and Manhattan real estate developers. By the fall of 1987, his former supporters at the socialist review Dissent would publish a special issue “In Search of New York” with an article titled, “When Koch Was a Liberal.”

But where his old friends saw betrayal, Mayor Koch saw an ideology that emerged as early as one Sunday in 1971, when he visited the site of a planned public housing project in Forest Hills, Queens. Koch was then a Democratic congressman from one of the nation’s most liberal districts, which included Greenwich Village and the Upper East Side of Manhattan. The Queens project was part of the expansive program pushed by Mayor John Lindsay, and would have brought about 4,000 poor people on public assistance to the middle class, heavily Jewish neighborhood.

Local residents said the project would destroy the neighborhood, Koch surprised his allies in Manhattan by agreeing with them. He later called that declaration “my Rubicon.”

“I have always been much more moderate than my supporters,” Koch told the Sun three decades later.

Born in 1924 in the Bronx to Jewish immigrants from Poland, and raised in Newark, New Jersey, Edward I. Koch came to politics gradually. After graduating high school at the age of 16, he enrolled at City College of New York and lived with his parents at their new home in Ocean Park, Brooklyn. Koch never graduated college, however; he was drafted in 1943, and served in France, Belgium, Holland, and Germany. Koch served on the front lines, but later wrote that “the saddest personal moment of the entire war” came when, as Hitler’s army retreated into Germany, a sentry in his unit shot and killed one of their own men.

After the war, Koch returned to New York and enrolled directly in New York University Law School. By 1952 he had his own law practice and had moved from volunteer positions at the Flatbush Jewish Center to politics in earnest. Captivated by the speaking style of Adlai Stevenson, who was running for president against Dwight Eisenhower, Koch joined the Stevenson campaign. He became a stump speaker: during his lunch hours, Koch recalled in a memoir, he would head out from his Wall Street office to stand on a chair at the corner of Broad and Nassau streets to praise Stevenson.

By 1963 Koch was active in Greenwich Village Democratic politics, and he made headlines across the city when he beat Tammany Hall boss Carmine DeSapio in a tight election for democratic district leader, a low-level position within the party.

As a local politician and a city councilman, Koch made his name in the fight to break the hold of an old guard of Manhattan Democratic Party leaders. But after heading to Washington in 1969, he began to develop the foreign policy views that he would later promote from the mayor’s bully pulpit, fighting to free Soviet Jews and to end the war in Vietnam.

Koch was elected mayor in 1977 on the slogan: “After eight years of charisma” – Lindsay – “and four years of the clubhouse” – Mayor Abe Beame – “let’s try competence.” The city needed a good manager, Koch argued. Lindsay’s big spending and Beame’s inability to bring the size of government back under control had produced a fiscal situation so dire that New York City could no longer borrow money.

By the time Koch took office, the city’s failure to balance its budget had put it in a kind of state-administered trusteeship, with the Emergency Financial Control Board making decisions usually reserved for mayors. Koch sought and won federal assistance, stopped the growth of city spending, and between 1978 and 1983 cut 7,000 city jobs.

“He was a very strong fiscal leader, and he led the city out of the fiscal crisis with great dexterity and resolve,” Diana Fortuna, former president of the Citizens Budget Commission said. “But it became harder to keep fiscal discipline as his administration went on and times got better.”

Despite his earlier criticism of Mayor Lindsay’s expensive projects, Mayor Koch in 1985 announced his grandest project of all: a five year plan to solve the city’s perpetual housing crunch and revive its most dilapidated neighborhoods. The plan would become a “ten year plan” and cost $5.1 billion – more than 80% of it financed by the city – and was “the most expansive and extensive city housing program in American history,” New York University real estate expert Michael Schill said.

The program succeeded on its own terms during and after the Koch era, rehabilitating about 183,000 units of housing and reviving neighborhoods, notably the South Bronx, that some city planners had recommended leaving for dead. A debate continues over the ten year plan’s cost-effectiveness, though Mr. Schill said his research shows that the program’s benefits had spilled over into surrounding neighborhoods, driving up property values and resurrecting whole sections of the city.

Despite the success of that program, Koch’s third term began badly. In January 1986, a scheme to defraud the city’s Parking Violations Bureau became public. The Queens Democratic Party boss Donald Manes and his Bronx counterpart Stanley Friedman had created a company that immediately and inexplicably won a lucrative contract with the bureau. Manes committed suicide that year, and Friedman was convicted on federal bribery charges. And while Koch was not personally implicated, he considered both men friends and had initially come to their public defense. He had won his first election running against the “clubhouse” represented by Abe Beame, but this was clubhouse corruption at its worst. The scandal shook the mayor so badly, he later claimed, that he considered suicide himself.

The year 1986 ended for Koch as badly as it had begun. One Saturday night in December, a group of white teenagers in Howard Beach, Queens, attacked three black men whose car had broken down nearby. They chased one man onto a highway, where he was hit by a car and killed.

Koch had alienated black leaders from the start. He had attacked the politicized administrators of federal anti-poverty money as “poverty pimps” and stood openly against affirmative action programs. He had been quoted musing that “the black community is very anti-Semitic” and “whites are basically anti-black.” In his first term, he had closed an under-used Harlem hospital over the vocal protests of black leaders.

But in his first two races, Koch had proven popular among black voters, and in the 1985 Democratic primary he won about as many black votes as a black rival. The Howard Beach killing helped set the stage for New York’s first black mayor, David Dinkins, to defeat Koch in the 1989 Democratic primary on a platform of racial reconciliation.

After twelve years as mayor of New York, Koch had nowhere to go. His run for governor in 1982 had foundered when he was quoted in Playboy disparaging farmers and suburbanites. His mantle in New York City politics, and the coalition of Jewish and white catholic voters who had kept him in office was inherited by Republican politicians – first Rudolph Giuliani, whom Koch crossed party lines to endorse in 1993, then Michael Bloomberg, for whom he was a stalwart ally.

But despite battling his successors, first Dinkins, and then Giuliani (Koch published a collection of newspaper columns titled: “Giuliani: Nasty Man” in 1999), he remained a vital figure in New York’s political scene. He spent the 1990s repairing his relations with black leaders like the Reverend Al Sharpton and he became a nearly unavoidable presence in New York’s print and broadcast media. From 1997 to 1999 he served as “judge” on the television show “People’s Court.”

Mayor Michael Bloomberg named a bridge to Queens after him, a choice he appreciated.

“There are other bridges that are more beautiful, like the GW or the Verrazano, but this more suits my personality cause it’s a workhorse bridge,” he told WNYC. “I mean, it’s always busy. It ain’t beautiful but it is durable.”

Koch spent his final as a partner at a pair of Midtown law firms, first Robinson Silverman Pearce Aronsohn & Berman and then Bryan Cave. His office wall, during that 2002 interview, was covered with medals he’d received from kings of Spain, Sweden, and the Netherlands and other royals. To his right were a scroll in Hebrew and English issued by the Jerusalem City Council declaring him “Guardian of Jerusalem.”

And Koch’s final political identity came from his intense support for Israel. He campaigned for George W. Bush in 2004, and endorsed President Obama in 2012 only after a personal appeal from the president on the sidelines of a United Nations gathering; he later criticized Obama’s approach to the region anyway.

Koch leaves no children. He never married, and determinedly left his sexual preference publicly ambiguous. In the last of his many memoirs, published in 2000, Koch wrote his own epitaph: “He was fiercely proud of his Jewish faith. He fiercely defended the City of New York and he fiercely loved the people of the City of New York.”

“For most people in New York, Koch is the mayor,” New York University Professor Mitchell Moss said back in 2002. “Rudy may be ‘America’s mayor,’ but Koch will always be New York’s mayor.”

Correction: An earlier version of this article stated the incorrect year in which Koch won about as many black votes as a black rival.

This obituary was reported for theNew York Sun, and is printed here with the permission of its editor.