They came by the thousands, in uniform and in civilian clothes, leading children, dogs and friends, or simply standing alone for what was sure to be a very long wait.

But the prospect of standing for hours to enter the church fazed no one who came to pay respects Friday to Officer Rafael Ramos, one of two policemen slain Dec. 20 in an attack that threw the city into mourning during this usually festive week.

“I would stand here until midnight if that's what it took,” Barry Hershfield said. “What else can you say when someone is assassinated on the job?

“It tore my heart apart,” Hershfield, a retired schoolteacher, said of the shootings.

A funeral for Ramos was scheduled Saturday at the Queens church where the 40-year-old worshiped. Ramos was killed alongside his partner, Wenjian Liu, 32, when a man with a history of posting online anti-police rants opened fire on them as they sat in their patrol car in Brooklyn. The gunman, Ismaaiyl Brinsley, 28, soon afterward shot himself to death in a subway station.

On Christmas night in Brooklyn, rows of blue roses are placed during a vigil to honor two slain NYPD officers.

On Christmas night in Brooklyn, rows of blue roses are placed during a vigil to honor two slain NYPD officers.

The unprovoked attack on the officers shook a city that already was in turmoil over this month's grand jury decision not to indict a white policeman in the death of an unarmed black man named Eric Garner. Garner's death in July had prompted large protests alleging police brutality.

The slayings have prompted appeals from city leaders, including Mayor Bill de Blasio, for a halt to more protests until after the officers' funerals. But they also have widened the rift between the mayor and police union leaders, who had long accused the liberal De Blasio of not giving officers the support they deserve.

On the night the officers were killed, union leaders said De Blasio was partly to blame for creating a climate that they said encouraged attacks on police. Patrick J. Lynch, the head of the Patrolmen's Benevolent Assn., said: “There is blood on many hands, from those that incited violence under the guise of protest to try to tear down what police officers did every day. That blood on the hands starts on the steps of City Hall in the office of the mayor.”

The tension between De Blasio and the unions was clear Friday when a small plane carrying a banner that read “De Blasio, Our Backs Have Turned to You” was flown over the Hudson River. The phrase was an allusion to the night of the officers' shootings, when several police officers turned their backs on the mayor as he arrived at the hospital where the mortally wounded officers had been taken.

Ashley Chalmers, owner of Jersey Shore Aerial Advertising, the company that flew the banner, said the people who paid for it wished to remain anonymous, but a former NYPD officer, John J. Cardillo, said in a statement posted on his blog that a “coalition of NYPD cops, detectives and supervisors hundreds strong” was involved in organizing the banner.

A statement released on their behalf by Cardillo accused De Blasio of creating a hostile climate toward the NYPD.

“They're right to be angry,” said Bobby Langer, a retired NYPD detective who was among those waiting in line to pay respects to Ramos. “My feeling is you're going to see more” attacks on officers because of the mood De Blasio has created, Langer added.

De Blasio will attend Ramos' funeral, as will Vice President Joseph Biden. A service for Liu, whose relatives must travel from China, has not yet been scheduled.

The normally bustling commercial area fell silent at midday as the hearse carrying Ramos' casket arrived outside the Christ Tabernacle Church. Officers in uniform and spectators watched the slow procession. A cordon of police saluted the flag-draped casket as other officers carried it through the church doorway for the wake.

“Today, we weep with the Ramos family,” said the church pastor, Rafael Castillo. “We are going to miss him a great deal.”

By the time the church doors opened for the wake, at 2 p.m., the line of people waiting to enter snaked for several blocks and extended out of the commercial district through the neighboring residential area. Mourners stood patiently on the sidewalk outside homes decorated with holiday lights, wreaths and trees.

One man sat on his porch beside a child's car seat holding an infant wrapped in a pink blanket. He watched the procession silently while rocking the baby chair back and forth.

In other parts of the city, flowers, candles and symbols of the holiday season piled up at memorials to the officers.

The attack has prompted police to take extra security precautions, and the police commissioner, William J. Bratton, says his department has assessed hundreds of online postings and calls to 911 about possible threats to officers. Seven people have been arrested as a result of the investigations, including a man who was allegedly overheard discussing killing police on Christmas Eve.

In a statement, police said a witness reported hearing the man talking on his cellphone in a Queens bank about “killing cops and possessing firearms in his house.”

A man fitting the witness' description was arrested a short time later. A search of his house turned up two firearms, including one with a defaced serial number; two bullet-resistant vests; brass knuckles; and a holster, police said. The man was being held on illegal weapons and other charges.

Times staff writer Javier Panzar in Los Angeles contributed to this report.