Police say a suspect grabbed a detective's gun and fired it, grazing the officer's head, then holed up for three hours in an empty office of the sheriff's building before shooting himself dead Wednesday.

In a news conference Wednesday evening, Dutchess County Sheriff's officials said the detective was treated and released from a hospital.

Officials said the suspect had been brought in for questioning Wednesday afternoon and grabbed the detective's .40-caliber semiautomatic pistol in an interview room about 1 p.m.

The building was evacuated during the standoff.

Officials refused to name the suspect or detective, citing the ongoing investigation.

Poughkeepsie is a city of 30,000 residents along the Hudson River 70 miles north of New York City.