Authorities say the man who killed himself after a standoff in a sheriff's office in Poughkeepsie, N.Y., was a registered sex offender who had been brought in for questioning about a rape.

They say Ken-Tweal Catts grabbed a detective's pistol in a Dutchess County Sheriff's office interview room, fired a shot that grazed the officer's head and then holed up in an empty office before shooting himself.

The building was evacuated during the three-hour standoff that began at about 1 p.m. Wednesday.

Sgt. Michael Danpf says Catts was released from prison in 2007 after serving three years for sexual abuse.

The detective was treated and released from a hospital. His name isn't being released.

Poughkeepsie is about 70 miles north of New York City.