He said the gunmen, some armed with M-16 rifles fitted with grenade launchers, thought they had been cornered and fired at everyone in sight.
"When they found out they were being trailed ... they went berserk," he said. "They fired all around, including at a flammable tanker beside a warehouse."
Among those killed were 12 suspected members of the gang and a police officer. Four people nearby, including a man and his 7-year-old daughter who were sitting inside their car, were also killed.
Authorities earlier had received tip that the group was planning to rob the warehouse, and police deployed dozens of police around the area to apprehend the suspects, according to Bataoil.
He said at least three of the gunmen were able to escape in a car they commandeered after firing a grenade at a gatehouse at the entrance to the community, wounding two guards.
Three police officers were also wounded, he said.
Bataoil said investigators believe the assailants belonged to a violent gang whose members have posed as police officers, adding that two of the slain gunmen were found wearing police-style bulletproof vests.
The group has been blamed for the killing of bank teller and two guards of an armored truck that was picking up money from a bank on the University of the Philippines campus last month.
Bataoil said he has ordered an investigation into the deaths of the civilians, particularly the man and his daughter.