NEW YORK - In 1977, New York City was deep into its worst fiscal crisis ever. Riots erupted that summer during a blackout. And a fire in one of the most blighted, bombed-out parts of town that fall led Howard Cosell to announce during a World Series game at Yankee Stadium: "Ladies and gentlemen, the Bronx is burning."

Into that mess stepped Ed Koch as the city's newly elected mayor. Within a few years, New York was back on firmer financial footing and the fears that the city was sliding into anarchy had given way to a new sense of energy and optimism.

Koch didn't do it all by himself, but is credited with hectoring, cajoling and noodging the city to make the hard decisions on its road back.

"The whole city was crumbling, and then we elected Ed Koch," Mayor Michael Bloomberg said Friday during a ceremony marking the centennial of Grand Central Terminal, a once-crumbling edifice Koch helped save from the wrecking ball.

"When we were down, Ed Koch picked us up. When we were worried, he gave us confidence," Bloomberg said. "When someone needed a good kick in the rear, he gave it to them — and, if you remember, he enjoyed it."

The brash, opinionated Koch, who led the city in the late 1970s and `80s with a combination of determination, chutzpah and humor, died Friday of congestive heart failure at age 88.

A funeral was set for Monday in Manhattan as tributes poured in from presidents, political allies and adversaries, some of whom were no doubt thinking more of his earlier years in City Hall, before many black leaders and liberals became fed up with what they felt were racially insensitive and needlessly combative remarks.

The Rev. Al Sharpton said that although they disagreed on many things, Koch "was never a phony or a hypocrite. ... He said what he meant. He meant what he said. He fought for what he believed."

President Barack Obama said in a statement that Koch's energy, force of personality and sense of commitment "always informed and enlivened the public discourse." Former President Bill Clinton and former Secretary of State Hillary Rodham Clinton praised him as a leader who "stood up for the underprivileged and underrepresented in every corner of every borough."

During Koch's three terms from 1978 to 1989, he helped New York climb out of its financial crisis through tough fiscal policies and razor-sharp budget cuts.

To much of the rest of America, the bald, paunchy figure became the embodiment of New York City's brash, irrepressible character — the mayor who raced around town asking average New Yorkers, "How'm I doing," and usually being in too much of a hurry to wait for an answer.

Quick with a quip or a putdown, Koch dismissed his critics as "wackos," feuded with Donald Trump ("piggy") and fellow former Mayor Rudolph Giuliani ("nasty man"). He lambasted the Rev. Jesse Jackson and once reduced the head of the City Council to tears.

"You punch me, I punch back," Koch once observed. "I do not believe it's good for one's self-respect to be a punching bag." Or as he put it in his best-selling autobiography "Mayor": "I'm not the type to get ulcers. I give them."

Koch's favorite moment as mayor, fittingly, was a loud one. During a 1980 transit strike, he strode down to the Brooklyn Bridge to boost the spirits of commuters who had to walk to work.

"I began to yell, `Walk over the bridge! Walk over the bridge! We're not going to let these bastards bring us to our knees!' And people began to applaud," he recalled last year.

But New Yorkers eventually tired of Koch. Homelessness and AIDS soared in the 1980s, and critics charged that City Hall's response was too little, too late. Koch's latter years in office were also marked by scandals involving those around him and rising racial tension.

In 1989, he lost a bid for a fourth term to David Dinkins, who became the city's first black mayor.

A lifelong bachelor who lived in Greenwich Village, Koch championed gay rights, taking on the Roman Catholic Church and scores of political leaders. His own sexual orientation was the subject of speculation and rumors. During his 1977 mayoral campaign against Mario Cuomo, posters that read "Vote for Cuomo, Not the Homo" mysteriously appeared in some neighborhoods.

Koch offered a typically blunt response to inquiries about his sexuality: "My answer to questions on this subject is simply, `F--- off.' There have to be some private matters left."

Describing himself as "a liberal with sanity," Koch supported President George W. Bush for re-election in 2004 and spoke at the GOP convention. He also endorsed Bloomberg's re-election at a time when Bloomberg was a Republican.

Proudly Jewish, Koch was an outspoken supporter of Israel.

After leaving office, he worked as a lawyer and continued to offer his opinions as a political pundit, movie reviewer, food critic and judge on "The People's Court." He wrote 10 nonfiction books, four mystery novels and three children's books, played himself in the movies "The Muppets Take Manhattan" and "The First Wives Club" and hosted "Saturday Night Live."

Edward Irving Koch was born in the Bronx on Dec. 12, 1924, the second of three children of Polish immigrants. During the Depression, the family lived in Newark, N.J.

After serving as a combat infantryman in Europe during World War II, he got a law degree and began his political career in Greenwich Village by winning a district leader race as a liberal Democratic reformer. Koch was elected to the City Council and then to Congress, serving from 1969 to 1977.

With New York in dire financial condition in 1977, Koch defeated Mayor Abe Beame and Cuomo in the Democratic primary to win his first term in City Hall. He breezed to re-election in 1981 and 1985, winning an unprecedented three-quarters of the votes cast.

In 1982, he made a run for governor against Cuomo, then the state's lieutenant governor. But Koch's bid blew up after he mouthed off about a possible move to Albany, saying that living in the suburbs was "wasting your life."

Koch's third term was beset by corruption scandals, one of which ended in the suicide of a top party boss in 1986.

Meanwhile, racial unease ran high after the deaths of two young black men who were set upon by gangs of whites in 1986 and 1989, and the mayor fell out with many black voters for purging anti-poverty programs and saying, among other things, that busing and racial quotas had done more to divide the races than to achieve integration. He also said Jews would be "crazy" to vote for Jackson during the civil rights leader's 1988 presidential campaign.

Koch attributed his defeat to longevity, not racial tensions. But he also said his biggest regret as he left office was that "many people in the black community do not perceive that I was their friend."

On Friday, Jackson said in a statement that Koch's "leadership and legacy will never be forgotten."

At 83, Koch paid $20,000 for a burial plot at Trinity Church Cemetery, at the time the only graveyard in Manhattan that still had space. "I don't want to leave Manhattan, even when I'm gone," he explained.

The funeral will be Monday at Temple Emanu-El in Manhattan. Dignitaries including Bloomberg and Ido Aharoni, the Israeli consul general in New York, will be among the speakers, said a person familiar with the arrangements, speaking on condition of anonymity because the person wasn't authorized to discuss them.


Associated Press writer Samantha Gross contributed to this report.