Five Ukrainian police officers have been shot dead by colleagues after an operation to snare a gang of burglars outside the capital Kiev went disastrously wrong.

Officials said Saturday night’s undercover operation unravelled when two plainclothes policemen conducting surveillance were detained by members of another police agency, the state security service, who were responding to a burglar alarm in a nearby house.

Police special-forces officers apparently thought the surveillance team had been caught by the criminal gang that was the target of the operation, and launched an attack to free them.

In the gun battle that followed, two undercover police officers, two members of the state security service and one special-forces officer were killed.

Reporting on the incident to Ukrainian president Petro Poroshenko, a top police official said the criminal gang was subsequently arrested near Kiev, and includes people who previously worked for, or had connections to, the security services.