Some police officers turn their backs in sign of disrespect as Mayor Bill de Blasio
Hundreds of police officers have turned their backs on the mayor of New York at the funeral of the second of two officers shot dead last month.
Wenjian Liu, a son of Chinese migrants, was killed with his partner Rafael Ramos on 20 December by a gunman with a grievance against the police.
Speakers lined up to pay tribute at the service in a Brooklyn funeral home.
In the street outside, hundreds turned their backs to a video screen when Mayor Bill de Blasio spoke.
Many rank-and-file members of the New York Police Department (NYPD) resent Mr de Blasio's expressions of sympathy for anti-police protesters in recent months.
The double murder by an African American gunman who claimed to be avenging black men killed by white police stunned the city.
New York police commissioner Bill Bratton had urged officers to refrain from any further "act of disrespect", saying in a memo, "A hero's funeral is about grieving, not grievance."
Mayor de Blasio told the funeral service: "All of our city is heartbroken today."
Liu, 32, had lost his life while fighting for "all that is decent and good", he said. He paid tribute to a "young man who came here from China at the age of 12 in search of the American dream".
Outside the funeral home, many uniformed officers could be seen turning their backs as the speech was relayed.
A lone police officer could be seen facing forward as colleagues turned their backs on Mayor Bill de Blasio's speech in one section of the crowd
New York Mayor Bill de Blasio (centre) leaving the funeral home with his wife Chirlane McCray (right)
Shortly after the policemen were shot, the head of the city's largest police union, Patrick Lynch, had lashed out at the liberal mayor, saying there was "blood on many hands".
More than 20,000 officers attended Ramos' funeral on 27 December, and the sight of lines of police turning their backs marred the event for some.
"The mayor has no respect for us," retired NYPD detective Camille Sanfilippo told the Associated Press news agency at Liu's funeral. "Why should we have respect for him?''
Patrick Yoes, a national secretary with the 328,000-member Fraternal Order of Police, said before the new funeral: "Across this country, we seem to be under attack in the law enforcement profession, and the message to take away from this is: We are public servants. We are not public enemies."
The two policemen were shot following a wave of demonstrations over killings of unarmed black men by white police officers, beginning in the Missouri town of Ferguson last summer.
There was anger in New York after a grand jury decided not to press charges against a white police officer over the death of unarmed black man Eric Garner, who was placed in a chokehold while being restrained by police officers.
Mayor de Blasio had expressed solidarity with the protesters and had publicly wondered if his son, who is mixed-race, was safe from police.
Some argue that such rhetoric helped to create an environment that encouraged violence against police.
'Love you forever'
Funeral arrangements had been delayed so relatives from China could travel to New York.
Wenjian Liu's widow, Pei Xia Chen, weeps while clutching a photo of her late husband
Hundreds of mourners took part in a candlelight vigil for Wenjian Liu, ahead of the funeral
The murder of a Chinese-American policeman has affected New York's Chinese community
A commemorative banner in Chinese could be seen at the wake
Police officers Wenjian Liu, left, and Raphael Ramos were shot while sitting in their patrol car
Liu's widow, Pei Xia Chen, said she had lost her "soul mate" and a "wonderful husband".
His father broke down at the funeral as he described how his only child would telephone after every shift during his seven years in the force to reassure his parents he was safe.
"You are the best son, you are the best husband," he said. "We are very proud of you, we love you forever."
A vigil was held on Saturday in Chinatown where community members gathered to burn pieces of paper in honour of Liu, in keeping with Chinese tradition.
The man who shot Ramos and Liu, Ismaaiyl Brinsley, killed himself in a subway station as police were closing in.
Brinsley, 28, had a history of violence and mental instability. On the day of the shooting, he went on social media to say he was planning to kill police officers.