Police said that there is no evidence of an attack and that it could have been as a result of an electrical fault igniting ammunition in the centre.
Most of the dead are police officers.
The explosion happened in the Swat valley, which was controlled by Islamist militants before they were forced out in 2009.
More than 40 people were injured and buildings have collapsed.
A spokesman for provincial police in Khyber Pakhtunkhwa, which neighbours Afghanistan, said that ammunition caught fire, "most probably due to an electric short-circuit".