HERKIMER, N.Y. — A man suspected of shooting six people, killing four of them, in upstate New York before firing at the police and barricading himself in a building was killed early Thursday when the police stormed the place where he was hiding.

Jack L. Keller, a State Police trooper, said that no officers were hurt in the operation, but that a police dog was injured. The Federal Bureau of Investigation assisted in the raid.

The first sign of trouble came shortly after 9 a.m. on Wednesday when a fire sent acrid smoke billowing above the village of Mohawk.

As firefighters made their way to battle the blaze, the police said, the man who set the fire made his way to a barbershop in the heart of the village and shot four people with a shotgun, killing two customers and critically wounding two others.