Edward Koch, who presided over New York City during the turbulent late 1970s and '80s and came to personify the city with his wry and outspoken style, died today at the age of 88, his spokesman said.
As mayor from 1978 to 1989, the forceful, quick-witted Mr Koch, with his trademark phrase "How'm I Doing?," was a polarising figure and the city's constant promoter.
Mr Koch died of congestive heart failure at about 2am at New York-Presbyterian hospital after a year of repeated hospitalisations, the spokesman for Mr Koch said.
Mr Koch was credited with lifting New York from crushing economic crises to a level of prosperity that was the envy of other US cities. Under his leadership, the city regained its fiscal footing and undertook a building renaissance.
In his capacity as New York mayor, Mr Koch endorsed the MacBride principles in April 1985. The principles, which were later incorporated into US law by president Bill Clinton, were devised by founding member of Amnesty International and Nobel Prize winner Seán MacBride.
But his three terms in office were also marked by racial tensions, corruption among many of his political cronies, the rise in AIDS and HIV, homelessness and a high crime rate. In 1989, he lost the Democratic nomination for what would have been a record fourth term as mayor.
Mayor Michael Bloomberg said the flags at all city buildings would fly at half-staff in Mr Koch's memory.
"In elected office and as a private citizen, he was our most tireless, fearless, and guileless civic crusader," Mr Bloomberg said. "His spirit will live on not only here at City Hall, and not only on the bridge the bears his name, but all across the five boroughs."
Mr Koch had a quip for every occasion and once said he wanted to be mayor for life. He was the only US mayor to have a bestselling autobiography that was turned into an off-Broadway musical.
This week, Koch, a documentary about his turbulent three terms as mayor, premiered at the Museum of Modern Art. Koch was unable to attend the premier.
"I don't think there was anybody who had more fun being mayor as Ed Koch," City Council speaker Christine Quinn, who is in the race to be the city's next mayor, said at the premier.
"Here was a mayor who was a combination of a Lindy's waiter, a Coney Island barker, a Catskill comedian, an irritated school principal and an eccentric uncle," New York writer Pete Hamill said in a 2005 discussion of Mr Koch's legacy. "He talked tough and the reason was, he was tough."
Born into a Jewish immigrant family in the Bronx in 1924, Edward Irving Koch went on to attend City College and later earn a law degree from New York University. He entered politics in the 1950s in Manhattan's Greenwich Village neighborhood, winning a seat on the city council, and later went to Washington, where he served four terms in the US House of Representatives.
In 1977, he made a second attempt running for mayor of New York City, and proved to be an agile campaigner. To combat rumors he was gay, former beauty queen Bess Myerson began appearing by his side at campaign events. Mr Koch later admitted the two were never romantically linked. Mr Koch remained a bachelor all his life and refused to answer questions about his sexuality even in his later years.
After two successful terms in office - he was returned for a third term with 70 per cent of the vote - Mr Koch's star had began to fade. A corruption scandal involving his ally, Queens Borough president Donald Manes, never implicated Mr Koch, but it damaged his reputation with voters.
Mr Koch's attempt at a fourth term failed when he lost his party's nomination to Manhattan borough president David Dinkins, a man as quiet and deliberative as Mr Koch was bold and abrasive. Mr Dinkins would go on to be the city's first black mayor.
"People became tired of Koch's personality," said Mitchell Moss, the director of the Urban Research Center at New York University. "He was a remarkable mayor but one with a big mouth. After 12 years you have to change the lyrics."
After leaving office, Mr Koch wrote articles on everything from Middle East politics to movie reviews, hosted a radio show and served as a judge on television's The People's Court.
He has remained a formidable figure in New York politics, endorsing candidates and offering political commentary on the local NY1 TV station. He has been a strong ally of New York's current mayor, Michael Bloomberg, and in 2010 he formed New York Uprising, a political action committee designed to fight corruption in state politics.
In 2008, Mr Koch announced he had secured a plot in Manhattan's Trinity Cemetery, telling the New York Times: "The idea of leaving Manhattan permanently irritates me."
Reuters