Hundreds of officers outside the New York City church where a funeral was held for a policeman killed along with his partner in an ambush shooting turned their backs on the mayor as he spoke during Saturday's service.