The shot from .32 bore revolver hit the roof, police said.
Nobody was injured, they said.
Balwant Singh of Behremke village in the district was in the secretariat for his personal work when his gun went off accidentally, they said.
Singh was arrested, police said, adding that he was later bailed out.