Police spokesman Frank Mba said in a statement late Wednesday that officers in central Taraba state "came under sudden attack and serious shooting by soldiers of the Nigerian army" as they arrested an accused kidnapper.
In addition to those killed, several other officers were wounded in the incident Tuesday in an area wracked by banditry, kidnapping and cattle-rustling, the statement said.
Mba said the soldiers then "released the handcuffed suspect, Alhaji Hamisu" and allowed him to escape.
The army confirmed the killings but insisted troops mistook the police officers for kidnappers.
"On the 6th of August 2019, the said Nigerian army troops, while responding to a distressed call to rescue a kidnapped victim, exchanged fire with the suspected kidnappers," army spokesman Sagir Musa said in a statement late Wednesday.
He said four suspects were shot and died on the spot while four others sustained various degrees of gunshot wounds and two others were reportedly missing.
"It was only after this avoidable outcome that one of the wounded suspects disclosed the fact that they were indeed policemen dispatched from... Force Headquarters, Abuja, for a covert assignment," he said.
Musa said the incident could have been avoided if there had been proper coordination between the two forces.
He said a joint investigation panel had been set up "in order to avert future occurrences of this nature".
Taraba is among states in central and northern Nigeria that have seen a surge in insecurity, including kidnappings.
The government has deployed special forces comprising police, army and air force members to flush out the criminals.
Kidnappers often wear official uniforms while seizing people in Nigeria.
Suspicions are widespread that elements of the security forces are involved in lucrative abductions for ransom.