NEW YORK CITY (CNN) -- Ed Koch, the brash former New York City mayor who typically greeted constituents with a "How'm I doin'?" died Friday at the age of 88, his spokesman said.
Koch died of congestive heart failure, spokesman George Arzt said. The former mayor felt very tired Thursday morning and was admitted to the intensive care unit, Artz said. Koch lost consciousness that afternoon and passed away around 2 a.m. Friday.
The lawyer-turned-public servant was a U.S. congressman from 1968 until he ran for mayor of the city in 1977. He served three terms until David Dinkins defeated him in a Democratic primary.
New York City has lost "an irrepressible icon," Mayor Michael Bloomberg said in a statement.
"In elected office and as a private citizen, he was our most tireless, fearless, and guileless civic crusader," Bloomberg said. "We will miss him dearly, but his good works -- and his wit and wisdom -- will forever be a part of the city he loved so much.
Koch told New York magazine in 1998: "I think my personality was helpful in this job. I always had a great sense of humor, though I am also pretty reserved personally. I mean, I don't go to chichi parties; never did. I don't like going to dinners other than small dinners at the homes of people. But I realized that if I was to harness the energies of the people of the city of New York and give them back their pride, I would have to become bigger than life. And I did."
After he left office, Koch -- whose ebullient personality made him popular nationwide -- practiced law, hosted a radio show, was a newspaper columnist and made countless appearances on TV series as himself. His cameos included "Sex and the City," "Spin City" and "Picket Fences."
For two years starting in 1997, he was the judge on the syndicated show "The People's Court."
He also reviewed movies online at The Mayor at the Movies site (mayorkoch.com).
In his later years, Koch became politically motivated again. In 2011, he grew upset after President Barack Obama called for Israel to return to its pre-1967 borders, with land swaps, as the basis of a Mideast peace deal.
In his anger, Koch crossed party lines to support Republican Bob Turner in his bid to represent perhaps the most Jewish district in the country, which covers parts of Queens and Brooklyn.
Koch's endorsement was widely seen as a turning point in a race that few expected a Republican to win. On the day of the special election, Turner won in an upset with 54% of the vote, with Koch standing next to him while he gave his victory speech.
"I like President Obama ... I helped get him elected," Koch said at Turner's election night party. "But he threw Israel under the bus."
But in September 2011, Koch said he was impressed with Obama's handling of the Palestinian bid for statehood at the U.N., where the president expressed support for Israel and called for more negotiations between the Israelis and Palestinians.
"I congratulated him on his speech to the United Nations in which he acknowledged Israel's presence in a difficult neighborhood," Koch said, referring to a party he attended that was hosted by Obama and his wife, Michelle, in New York.
Edward Irving Koch was born in the Bronx on December 12, 1924. The family moved to New Jersey when he was 8. He went to the City College of New York until he was drafted into the Army in 1943. After he left the service as a sergeant in 1946, he studied law at New York University.
He began his public service life as a district leader in Greenwich Village in 1963; he also served on the New York City Council before running for Congress.
The New York Times said in a 2011 retrospective that Koch seemed an unlikely candidate for mayor in 1977.
"He was a geeky, relatively obscure congressman, considered too liberal to appeal beyond his Greenwich Village constituency," the Times said on its website.
His campaign manager, David Garth, came up with a slogan that helped Koch beat fellow Democrat Mario Cuomo, who many commentators viewed as the more dynamic character, and Republican Roy Goodman.
''After eight years of charisma and four years of the clubhouse, why not try competence?" was a slogan that spoke to New Yorkers who were disappointed by Koch's predecessors, John Lindsay and Abe Beame.
Koch was a popular mayor -- winning a second term with 75% of the vote and a third with 78% -- but as the Times put it: "With New Yorkers wearying of his in-your-face shtick and seeking a balm to racial polarization, Mr. Koch was defeated for the Democratic nomination by Manhattan Borough President David N. Dinkins."
Before he was defeated by Dinkins, he criticized the Rev. Jesse Jackson, a candidate for president in 1988, and some felt he angered many black voters. Race relations in New York were also fractured at the time, especially after a 1986 incident in Howard Beach when white teenagers attacked three black men, killing one.
Koch's third term was beset by corruption scandals involving his political allies. Koch himself was never directly tied to wrongdoing, but the scandals hurt Koch's image with voters. Only three New York mayors were ever re-elected twice -- Fiorello LaGuardia and Robert Wagner were the others -- and all three left office, as The New York Times put it in 2008, "drained, diminished and disdained."
Some new Yorkers thought Koch, who published an autobiography in 1984, had lost control of his ego.
Koch even said he lost because "voters got tired of me."
Koch, who never married, was often criticized by playwright, novelist and LGBT rights advocate Larry Kramer for not doing more to stop the spread of AIDS in New York.
"He was a closeted gay man, and he did not want in any way to be associated with this," Kramer declared to New York magazine.
Koch found discussions of his sexuality to be humorous.
"Listen, there's no question that some New Yorkers think I'm gay, and voted for me nevertheless. The vast majority don't care, and others don't think I am. And I don't give a (expletive) either way!" he told New York magazine.
There will be a funeral on Monday.