Sgt. Kelvin Ansari had served in the U.S. Army for more than 20 years before joining the police department, officials said.