Back then, New York City was nearly bankrupt. It was hot, and the Son of Sam was still on the loose.

And then the lights went out.

The 1977 blackout in New York struck a city already on edge and threatened to push it over. The power outage, which began the night of July 13 and lasted up to 25 hours in some places, triggered widespread looting and arson and is considered among the lowest points in New York history.

"It seemed to have been symptomatic of the city's malaise at the time - the economy was down, crime seemed to be going up, people were moving to the suburbs," said Kenneth T. Jackson, president of the New-York Historical Society and editor of The Encyclopedia of New York City. "The '70s were probably the worst decade in New York's history."

To longtime New Yorkers like Jackson, yesterday's blackout brought back memories of not just the devastating 1977 blackout, but also of a previous outage in 1965. And in fact, the two blackouts have a sort of yin-yang relationship in New York's collective memory, illustrations of the city at its best and its worst.

The first blackout started at 5:27 p.m. Nov. 9, 1965. A faulty relay at a power station in Ontario, Canada, triggered overloads in the Northeast power grid, wiping out electricity across the entire Northeastern part of the United States and several Canadian provinces. An estimated 30 million people were left in the dark.

In New York, there was an outbreak of conviviality rather than looting. Stranded travelers camped out in hotel lobbies, and people helped direct the snarled traffic and the firefighters leading subway riders up from the underground cars that were halted in their tracks.

"The 1965 blackout is sort of remembered fondly. It was a shared experience. No one died," said Jackson, a history professor at Columbia University. "The myth is everyone went home and made love."

Indeed, the nine-months-later baby boom has become legendary. On August 10, 1966, The New York Times reported sharp increases in births at several large hospitals: Mount Sinai, which usually had 11 births a day, had 28 one day. At Bellevue, there were 29 babies in the nursery, up from 11 the previous week.

A University of North Carolina researcher, however, punctured the myth with a paper published in 1970, showing that the blackout had no effect on the city's birthrate.

But whatever happened during those hours when the lights were out - power was fully restored by 6:58 a.m. the next morning - New Yorkers remember the 1965 blackout warmly, particularly in contrast to the next major outage that they would experience.

At 9:34 p.m. on July 13, 1977, a miserably hot summer night got even worse when the power suddenly went out. This time, the culprit was lightning, which struck several power lines in Westchester County north of the city, shutting down the Indian Point generating station on the Hudson River. Subsequent lighting bolts shut down additional facilities, and soon all five boroughs as well as areas of Westchester County lost all electric power.

In the hot darkness, several New York ghettoes - Harlem, the South Bronx and Bedford-Stuyvesant among them - erupted in looting and arson.

"It's Christmastime, it's Christmastime!" looters cried, Time magazine reported, as they emptied stores.

Arsonists set more than 1,000 blazes, and firefighters were struck with rocks when they arrived to put them out.

When it was all over, nearly 4,000 people were arrested and 55 firefighters were injured. Property damage was estimated at $150 million.

While not excusing the looters, some historians say the violence has to be viewed in the context in which the blackout occurred.

"It came amidst a recession, there had been massive cutbacks in very basic city services like schools and public recreation," said Joshua B. Freeman, chairman of the history department at the City University of New York's Graduate Center. "There was high unemployment. It was a very irritable city that saw its quality of life going down. There was greater ethnic and racial tension than today - that was the context."

Freeman, who was in a subway car yesterday when the power went out and was trapped underground for an hour, wrote about the 1977 blackout in his book, Working-class New York: Life and Labor Since World War II. In it, he describes how the blackout fed into the view of New York as an urban mess, with news stories quoting police and others calling the looters "animals," and pictures showing neighborhoods as bombed-out war zones.

"There was something over the top about the language," he said. "It reflected the fear and meanness of the white middle class, and the white upper class."

Yesterday's blackout, beginning as it did during daylight, unfolded in a vastly different way. In addition, the city has changed - for the better - in the 26 years since the last blackout, experts say.

"The city is a different place," Jackson said. "There's more order, and just good feelings."

Much of that, he believes, comes from a true disaster that the city faced, and survived, almost two years ago.

"I think one of the things that emerged from 9/11 is a sense of people coming together," Jackson said. "There was good that came out of it, I think we still have that good feeling."