The overnight shoot-out between two sets of police began when each side believed the other to be criminals.
It happened near Kiev and has been described as a "heartbreaking tragedy".
The gunfight began when a burglar alarm went off by chance in the house next door to one being staked out by two undercover policemen.
A separate unit then arrived to investigate the alarm, in the small town of Knyazhychi, and detained the pair, mistaking them for robbers.
But the back-up unit for the two men apparently feared they had been confronted by the thieves and tried to rescue them.
Interior ministry adviser Anton Herashchenko said those suspected of being the real burglars - who were nearby - heard the gun battle and fled in two vehicles.
The three were arrested soon afterwards with firearms in the capital, Kiev, the Kyiv Post reported, and it is expected they will be charged with numerous criminal offences.
The former chief of national police Khatia Dekanoidze described the shooting as a "heartbreaking tragedy", the paper reported.
Five police officers in Ukraine have been killed by friendly fire during a botched operation to arrest robbers, an interior ministry official has said.