A properly functioning fire sprinkler quickly controlled a fire on the third-floor deck of an apartment building on New Year’s Day, averting what could have been a catastrophic fire.

The Harrisonburg Fire Department revealed on Thursday that the cause of the fire at North 38 was accidental due to improperly discarded smoking materials.

Flammable liquids nearby caused the fire to grow quickly, but was controlled by the sprinkler.

Fire officials are now reminding residents of the dangers of improperly discarding smoking materials.

"We've seen, especially in apartment buildings, some pretty serious fires caused by that," said Katie Caler with the Harrisonburg Fire Department. "They tend to cause some pretty catastrophic fires, at least that's the history in Harrisonburg."

Last year, an improper discarded smoking material caused a massive fire at The Hills at Southview apartment complex and displaced 40 students.

Caler said it's critical to take the extra steps to “wash the butts” by dousing smoking materials in water before discarding.

"If you are smoking at an apartment, out in public, or in your own home, make sure you are discarding them in the proper receptacle," she said.

According to the National Fire Protection Association, smoking materials, including cigarettes, pipes, and cigars, started an estimated 17,200 home structure fires reported in the U.S. annually. These fires caused 570 deaths, 1,140 injuries and $426 million in direct property damage.

HFD says damage for this fire has been set at $7,500 and the saved value of the building at more than $3 million.