NEW YORK — Thousands of police officers from across the nation packed a church and spilled onto streets Saturday to honor Officer Rafael Ramos as a devoted family man, aspiring chaplain and hero, though an air of unrest surrounding his ambush shooting was not completely pushed aside.
While mourners inside the church applauded politely as Mayor Bill de Blasio spoke, hundreds of officers outside turned their backs on him to protest what they see as his support for demonstrators angry over killings by police.
The rush of officers far and wide to New York for Ramos' funeral reminded some of the bond after the Sept. 11 attacks and Superstorm Sandy. Vice President Joe Biden promised that the "incredibly diverse city can and will show the nation how to bridge any divide."
Still, tensions were evident when officers turned away from giant screens showing de Blasio, who has been harshly criticized by New York Police Department union officials as a contributor to a climate of mistrust that preceded the killings of Ramos and his partner, Wenjian Liu.
Sgt. Myron Joseph of the New Rochelle Police Department said he and fellow officers turned their backs spontaneously to "support our brothers in the NYPD."
In a statement, de Blasio's spokesman said: "The Ramos and Liu families, our police department and our city are dealing with an unconscionable tragedy. Our sole focus is unifying this city and honoring the lives of our two police officers."
The NYPD said through its public relations office that it had no comment.
In his eulogy, de Blasio said hearts citywide were broken after the Dec. 20 shootings.
"All of this city is grieving and grieving for so many reasons," de Blasio said. "But the most personal is that we've lost such a good man, and the family is in such pain."
Gov. Andrew Cuomo praised the sea of blue mourners for their professionalism at recent rallies over police conduct when protesters insulted them, and Biden spoke passionately about the effects of the officers' deaths.
"When an assassin's bullet targeted two officers, it targeted this city and it touched the soul of an entire nation," the vice president said.
Police union officials in contentious contract negotiations with the city have faulted de Blasio for showing sympathy to protesters angry over the police deaths of Michael Brown in Ferguson, Missouri, and Eric Garner on Staten Island.
At a hospital after the officers' slayings, the police union's president, Patrick Lynch, and others turned their backs on de Blasio. Lynch said the mayor had "blood on his hands."
After the funeral, Lynch and de Blasio exchanged nods as they exited the church. Lynch refused to answer reporters' questions about officers turning their backs.
Weeks before the shooting, Lynch had suggested officers sign a petition requesting that the mayor not attend their funerals were they to die in the line of duty.
Soon after taking office this year, de Blasio dropped the city's opposition to a judge's finding that the police department discriminated against minorities with its anti-crime stop-and-frisk tactics.
But since last week's shootings, de Blasio has stood firmly by police, calling on demonstrators to temporarily halt protests and praising the department after it arrested several men charged with threatening police.
The killings shook the city and put an end to large-scale local protests criticizing police over the high-profile, in-custody deaths.
When the Ramos family arrived at church Saturday, the elder son — wearing his father's NYPD jacket — was hugged by a police officer.
Ramos, a 40-year-old married father of two, was studying to become a pastor and kept Bible study books in his locker, his commanding officer said.
Police Commissioner William Bratton said Ramos had been made honorary chaplain of the police precinct where he had worked.
Bratton said in his eulogy that Ramos and Liu would be "partners for all time." Speaking to Ramos' children, he said: "We are here because your dad was assassinated. It's a different word than 'murdered.' It makes the crime intentional and symbolic. Your dad was assassinated because he represented something."
Officer Dustin Lindaman of the Waterloo Police Department flew from Iowa to attend the funeral.
"He's one of our brothers, and when this happens, it affects everyone in law enforcement — it absolutely affects everyone," he said.
A block from the church, retired NYPD Officer John Mangan held a sign that read: "God Bless the NYPD. Dump de Blasio."
"If the mayor really wanted to do the right thing, he would have gotten into an NYPD car and rode around Bed Stuy and see the difficult jobs these cops do every day," Mangan said.
After the officers' deaths, the gunman, Ismaaiyl Brinsley killed himself. Police said he was troubled and had shot and wounded an ex-girlfriend in Baltimore earlier that day.
In online posts shortly before the attack, Brinsley referenced the killings of Brown and Garner, both of whom were black, by white police officers.
Ramos and Liu were the first officers to die in the line of duty in New York since 2011. Funeral plans for Liu haven't been announced.
They have both been posthumously promoted to first-grade detective.