John Minchillo, Associated Press
Some police officers turn their backs as Mayor Bill de Blasio speaks during the funeral of New York Police Department Officer Wenjian Liu at Aievoli Funeral Home, Sunday, Jan. 4, 2015, in the Brooklyn borough of New York. Liu and his partner, officer Rafael Ramos, were killed Dec. 20 as they sat in their patrol car on a Brooklyn street. The shooter, Ismaaiyl Brinsley, later killed himself.

NEW YORK — Thousands of city police officers turned their backs Sunday as they watched Mayor Bill de Blasio eulogize an officer shot dead with his partner, repeating a stinging display of scorn for the mayor despite entreaties to put anger aside.

The show of disrespect came outside the funeral home where Officer Wenjian Liu was remembered as an incarnation of the American dream: a man who had emigrated from China at age 12 and devoted himself to helping others in his adopted country. The gesture among officers watching the mayor's speech on a screen added to tensions between the mayor and rank-and-file police even as he sought to quiet them.

"As we start a new year, a year we're entering with hearts that are doubly heavy" from the loss of Officer Liu and his partner, Officer Rafael Ramos, "let us move forward by strengthening the bonds that unite us and let us work together to attain peace," de Blasio said.

Liu, 32, had served as a policeman for seven years and was married just two months when he was killed with his partner, Officer Rafael Ramos, on Dec. 20. Liu's longtime aspiration to become a police officer deepened after the Sept. 11 terror attacks, his father, Wei Tang Liu, said through tears.

And as he finished his daily work, the only child would call to say: "I'm coming home today. You can stop worrying now," the father recalled during a service that blended police tradition with references to Buddha's teachings.

Dignitaries including FBI Director James Comey and members of Congress joined police officers from around the country in a throng of over 10,000 mourners.

"When one of us loses our lives, we have to come together," said Officer Lucas Grant of the Richmond County Sheriff's Office in Augusta, Georgia.

Gov. Andrew Cuomo called the officers' slayings a tragic story of "pure and random hatred" on Saturday after going to Liu's wake. Cuomo didn't attend the funeral, which came as he prepared to bury his father, former Gov. Mario Cuomo.

The officers' killer, Ismaaiyl Brinsley, committed suicide shortly after the brazen daytime ambush on a Brooklyn street. Investigators say Brinsley was an emotionally disturbed loner who had made references online to the killings this summer of unarmed black men at the hands of white police officers, vowing to put "wings on pigs."

The deaths strained an already tense relationship between city police unions and de Blasio. Union leaders have said he contributed to an environment that allowed the killings by supporting protests following the deaths of Eric Garner on Staten Island and Michael Brown in Ferguson, Missouri.

The head of the rank-and-file police union, which is negotiating a contract with the city, turned his back on the mayor at a hospital the day of the killings and said de Blasio had "blood on his hands." Last week, hundreds of officers standing outside Ramos' funeral turned their backs toward a giant TV screen as de Blasio's remarks played.

Many people, including Cardinal Timothy Dolan, have since pressed all parties to tone down the rhetoric. And this weekend, Police Commissioner William Bratton sent a memo to all commands urging respect, declaring "a hero's funeral is about grieving, not grievance." Officers who turned their backs on de Blasio on Sunday spun back around when Bratton took the podium to speak after the mayor.

On Saturday, officers standing outside Liu's wake saluted as the mayor and commissioner entered. On Sunday, the mayor got a respectful reception among police officials inside the funeral home.

But some ill will was visible ahead of de Blasio's scheduled remarks at Liu's funeral. Retired NYPD officer John Mangan stood across the street from the funeral home with a sign that read: "God Bless the NYPD. Dump de Blasio." And Patrick Yoes, a national secretary with the 328,000-member Fraternal Order of Police, said he applauded the New York police union leader's stance toward the mayor.

"Across this country, we seem to be under attack in the law enforcement profession," Yoes said. "We are public servants. We are not public enemies."

George Breedy, a lieutenant with the St. Charles Parish Sheriff's Department in Louisiana, said he had no plans to protest de Blasio, calling the rift between officers and the mayor a "local issue."

"We're here to pay respect to the officers," Breedy said.

Liu's funeral arrangements were delayed so relatives from China could travel to New York, where he married Pei Xia Chen this fall.

"He is my soul mate," she said. "My hero."

Associated Press writer Jennifer Peltz contributed to this report.