Randolph Holder, shot in the line of duty, was promoted to first-grade detective with Shield 9657 at his funeral service Wednesday by his NYPD commissioner, launching an extended round of applause in the Queens church.

It was the same number that belonged to the shield of Holder's father, who had been a policeman in their native Guyana, Police Commissioner William Bratton told the mourners.

"Detective Randolph Holder, you are relieved of your duty as a New York City police officer, a guardian at the gates of New York City," Bratton said, "and we send you on your way . . . to be a guardian angel at the gates of heaven."

Many spoke of Holder's calling to be a cop and his generous nature -- his fiancee, his aunt, New York City's mayor and Guyana's ambassador to the United States -- as thousands of men and women in blue from far and near braved the elements outside to pay their respects.

"What is loss?" said Mary Muhammad, Holder's fiancee, who was flanked by two friends as she spoke at the Greater Allen A.M.E. Cathedral in Queens.

"Because of the love I was so blessed to experience . . . I have learned a different word and that is courage."

The funeral services began just before 4 p.m. for Holder, who was killed at 33. The five-year officer was shot in the head Oct. 20 by the robbery suspect he was pursuing, police said.

Inside the church, Holder was described as a generous spirit, who gave a helping hand to neighbors and colleagues, served as the DJ at family gatherings and was a police officer with a great "mental database" of people on his route and even locations of elevators in the housing units that he patrolled.

"He was a gentleman with a quiet purpose and a sense of job fulfillment," said his aunt Margaret Holder.

At age 21, he left Guyana to join his father, stepmother and siblings in Far Rockaway, she said.

"No one ever saw him angry," Margaret Holder said.

Mayor Bill de Blasio, attending the fourth NYPD police funeral this year, spoke of Holder as a family man who often started stories with "my grandmother taught me."

The mayor told the story of how Holder began giving rides to a colleague who didn't have a car -- he did it for four years without a complaint and often sang along to songs on the radio, seeming to know all the lyrics, no matter what era the song.

People nicknamed Holder "Doc," the mayor said, because he had the answers when they went to him for help.

"All of New York City is in pain at this moment," the mayor said.

De Blasio spoke of keeping guns from criminals and keeping criminals from walking the streets, while Bratton described safeguarding the community as a shared responsibility.

Holder was pursuing a robbery suspect Oct. 20 in Manhattan when he was shot in the head by the man, police said.

He and his partner, Omar Wallace, had encountered a man who said his bike had been stolen by a gunman. The partners saw a man on a bicycle on a footpath near East 120th Street, and that was where the suspect fired once, the fatal shot for Holder, police said.

"When you're willing to risk everything, sometimes it will cost you everything," Bratton said at the service.

Wallace fired back, and the suspect was hit in the leg, police said.

In the church Wednesday, the police commissioner praised Wallace, saying he provided critical information that helped other officers nab the gunman two days later: "On that terrible night, he defended us and he defended his partner. . . . Omar did it all that night. He is a hero."

Tyrone Howard, 30, of East Harlem, was charged with one count of first-degree murder. A .40-caliber Glock found days later in the Harlem River was the weapon used, police said forensic tests confirmed.

Before the service started about 4 p.m. inside the cathedral, many officers greeted one another until a voice over a loud speaker urged them to "fall in," or line up, for the start of services. They had come from far and near for this moment, including an expected 400 Nassau police officers.

The mayor had made his way into the brown brick cathedral just after 2:30 p.m. as many other supporters stood beside officers to mourn the passing of Holder, a Brooklyn resident who will be buried in his native Guyana.

"I always give them my support," said Marlene Morales, 50, of Jamaica, standing across the street from the funeral. "Not all of them are bad. At the end of the day we need them in the community."

Mary Muhammad said earlier this week that she would create a foundation to raise money to send unused police equipment to the police department in Guyana, Holder's home country.

Correction

The suspect was caught shortly after NYPD Officer Randolph Holder was shot. A previous version of the story misstated when he was apprehended.