Basements, often a cool refuge in the summer, can be deadly traps when a fire breaks out in a home.

Now, a state building code that will take effect on Oct. 1 will require residents to add fire exits or extra-large windows to basements if they apply for a permit to finish or renovate those rooms. The new code will not apply to residents who receive a building permit before that date or who already have finished basements.

The code, which will also apply to new construction, comes after several local fires in which people died or were nearly killed because their basements did not have an escape route.

A 32-year-old Merrifield man died when he couldn't get out of his cellar during a fire in April 2002. Four members of a family perished earlier that year in their basement in Montgomery County in similar circumstances.

In December of last year, two children in Baileys Crossroads were nearly killed when a dry Christmas tree caught on fire in the home they were sharing with two other families. Three people on the first floor died. The two children escaped by squeezing through a basement window with a neighbor's help.

Renee Stilwell, spokeswoman for Fairfax County's Fire and Rescue Department, said many residents turn basements into guest rooms, even if there aren't adequate fire exits or alarms.

Those rooms, she said, often "will have really small windows, and then they turn them into sleeping areas, so if a fire occurred, they could be trapped. . . . It is a legal basement, but not a legal bedroom."

Ray Pylant, the acting building official for Fairfax County, added that having one interior stairway in a cellar is not enough, especially if the flames originate on the floor above the basement.

"If you have a basement that is totally below grade, and the only way to exit and enter is an interior staircase, then that will obstruct anyone's ability to get out," he said.

Other fire codes are being scrutinized after a fire this month that torched 18 condominiums in Kingstowne and killed three residents.

Several fire officials in Virginia say homes are being built too close together, allowing flames to jump easily between buildings.

National building codes, which states can adopt, call for single-family houses to be built just six feet apart, but in the Kingstowne blaze, radiant heat nearly ignited a building 34 feet away.

According to the National Fire Protection Association, there were 16,500 basement fires nationwide in homes and apartments in 1999, the last year the organization compiled the statistic, said Margie Coloian, director of public affairs. The vast majority of those fires happened at night, when people were sleeping.

Owners of older homes who don't plan to renovate or already have finished basements should also have proper fire exits, said Stilwell, the county fire department spokeswoman.

At the least, she said, "When basements have no other way of evacuation, if you are going to use them, make sure they are properly armed with smoke alarms."

In December, two children in Baileys Crossroads, below, escaped a fire by squeezing through a basement window, but three people on the first floor died. A fire this month in a Kingstowne condominium complex, left, killed three people.