A local government official said the militants, disguised in security uniforms, stormed the building during a transfer of inmates from one jurisdiction to another, China's state-run Xinhua News Agency reported.
Witnesses said the attackers tried to free the prisoners and exchanged gunfire with security personnel. During the confrontation, the attackers lobbed hand grenades, killing six people at the scene.
Xinhua said several reports indicated another militant detonated his explosive jacket when security personnel tried to arrest him.
No one immediately claimed responsibility for the attack.
Couple calls 9-1-1 over missing hash browns; assault McDonanld's employees
Workers accuse National Zoo of animal mismanagement