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