Updated

Thousands of police officers from across the country assembled in winter sunshine in New York City for the funeral of Rafael Ramos, a police officer shot to death with his partner in an ambush last week.

The officers in dress blue uniforms stood outside the Christ Tabernacle Church in Queens for the Saturday morning services. The sea of blue stretched more than six city blocks.

In his eulogy, Mayor Bill de Blasio offered the city's condolences to the Ramos family.

"All of this city is grieving and grieving for so many reasons," he said. "But the most personal is that we lost such a good man."

Vice President Joe Biden expressed his condolences to Ramos' two sons.

More On This...

    “You’ve shown tremendous courage these past days,” he said.

    He said Ramos and his partner Wenjian Liu were officers who were committed, passionate and vigilant.

    “Being a cop was not what they did, it was who they were like every man and woman in uniform today and they, like every one of you here and outside, all joined for the same reason,” Biden said.

    The church applauded when Biden called the New York Police Department the finest in the world.

    "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.

    “I believe this police force will show the nation how to bridge any divide,” he said.

    Police Commissioner Bill Bratton told the mourners they knew who officer Ramos was. "Father, son, brother and husband," he said. "He was a New Yorker. He was a New York City police officer.

    The church erupted in applause when Bratton ended by saying Ramos was a hero.

    There were also cheers when Bratton said he had promoted Ramos to detective first grade and appointed him an honorary department chaplain.

    Bratton said Ramos and his partner were assassinated because of who they were. "They were killed for their color," the commissioner said. "They were blue."

    Gov. Andrew Cuomo called the shooting of the two officer "an attack on all of us."

    As de Blasio delivered his remarks hundreds of officers, watching on giant TV screens outside the church, turned their backs on the mayor.

    The mourners in blue began showing up at the church early.

    "He was studying to be a pastor. He had Bible study books in his locker, which is rare for a police officer, but that goes to show you the type of man he was," NYPD Capt. Sergio Centa said before entering the church.

    "Law enforcement isn't just your own department; it runs deep," said Lt. Chris Thibault of the Ridgefield Park, New Jersey, Police Department.

    When the Ramos family arrived, the eldest son -- wearing his father's New York Police Department jacket -- was hugged by a police officer.

    Funeral plans for Liu, have yet to be announced.

    The officers were killed Dec. 20 while sitting in their patrol car on a street in Brooklyn's Bedford-Stuyvesant section. Investigators have said the gunman, Ismaaiyl Brinsley, was troubled and had shot and wounded an ex-girlfriend in Baltimore earlier that day.

    Ramos was described Friday during an eight-hour wake as a selfless, caring and compassionate man.

    "What happened to my father was a tragedy," Ramos' son, Justin, said in a tearful eulogy viewed by hundreds of officers in the street who watched on giant television screens outside the crowded church. "But his death will not be in vain."

    Ramos, a 40-year-old married father of two, wanted to be a police chaplain and kept Bible study books in his locker, his commanding officer said.

    Officer Dustin Lindaman of the Waterloo Police Department flew from Iowa to attend Ramos' funeral.

    "He's one of our brothers, and when this happens, it affects everyone in law enforcement -- it absolutely affects everyone," he said. "We wanted to show our support."

    The man who killed Ramos and his partner committed suicide soon after the shooting. In online posts shortly before the attack, Brinsley referenced the killings of two unarmed black men -- Michael Brown in Ferguson, Missouri, and Eric Garner on Staten Island -- by white police officers.

    Police union officials have said de Blasio contributed to a climate of mistrust toward police amid protests over the deaths of Brown and Garner. At a hospital after the shooting, the police union's president, Patrick Lynch, and others turned their backs on the mayor in a sign of disrespect. Lynch blamed the mayor then for the officers' deaths and said he had blood on his hands.

    Weeks before the shooting, Lynch suggested that officers sign a petition requesting that the mayor not attend their funerals were they to die in the line of duty.

    Cardinal Timothy Dolan and others have since tried to temper the rhetoric.

    De Blasio has stood firmly by the police since the shooting, calling on the demonstrators to temporarily halt their protests and praising officers after the police department announced the arrest of a seventh person since the shooting for making threats against police.

    There was no noticeable reaction from police outside the church when de Blasio first arrived Saturday about a half hour before services.

    A block from the church, though, 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. "The bottom line is there should be more signs out here in support of these cops."

    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