Streets outside the church were filled for blocks with neat, quiet crowds of officers in blue uniform, including delegations from Boston, Atlanta, St. Louis and New Orleans. Biden said some 25,000 people were thought to have come.
Before joining the police department relatively late in his career, Ramos, known to his friends as Ralph, had worked as a school safety officer.
"He knew how to handle people, and the younger guys looked up to him," said Bill Bratton, the city's police commissioner. A regular face as an usher at Christ Tabernacle, Ramos had nearly completed a course to become a police chaplain.
Bratton, a far more popular figure among police than the mayor, announced that he had posthumously appointed Ramos to the position.
The officers' killer, Ismaaiyl Brinsley, 28, was described by city officials as an emotionally troubled man, and fatally shot himself soon after the attack.
Brinsley, who was black, had written online that he wanted to kill police to avenge the deaths of Eric Garner and Michael Brown - unarmed black men killed by white policemen in New York and Ferguson, Missouri, this summer.
Their deaths and the decisions not to prosecute the officers responsible ignited nationwide protests, renewing a debate about race in the United States that has drawn in President Barack Obama.
In his first year as mayor after campaigning for police reform, de Blasio has struggled to balance the interests of police critics who helped elect him and the officers who now work for him. This week, he was assailed by voices on both sides, with activists angered by his call, which they ignored, that they pause their protests.
Ramos' family said the mayor was welcome at the funeral, but even many officers who did not turn their backs said they sympathized with the gesture.
"A lot of people feel he has taken a side, and that side is not ours," a New York police officer said on condition that her name be withheld because of a department ban on unsanctioned media interviews.
Patrick Lynch, president of the city's largest police union, said within hours of the deaths of Liu and Ramos that there was "blood on the hands" of the mayor.
"We have to understand the betrayal that they feel," Lynch, in an interview outside the church with CNN, said of the officers' protest. "The feeling is real, but today is about mourning. Tomorrow is about debate."