GLENDALE, N.Y. -- 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.
PHOTOS: Funeral held for NYPD Officer Rafael Ramos
Although mourners inside the church applauded politely as Mayor Bill de Blasio spoke, hundreds of officers outside turned their backs on him in a show of disrespect for what they see as his support for anti-police protesters.
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 contributed to the killings of the officers.
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."
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 killings of Ramos and his partner, Officer Wen Jian Liu, in their patrol car.
VIDEO: City mourning fallen NYPD officer at wake
"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 no charges were filed in 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.
De Blasio later released a statement saying, "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."
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.
Funeral plans for Ramos' partner, Officer Wenjian Liu, have yet to be announced.
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 announced in a eulogy that 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.
They have both been posthumously promoted to first-grade detective, police said.
The Associated Press contributed to this report.