A prosecutor says a Connecticut police officer was justified when he shocked a man with a stun gun for 20 seconds shortly before the man died of a heart problem and blunt injury to his head.