EAST HARLEM — An NYPD officer was shot and killed Tuesday night trying to arrest a man after shoot out between rival gangs in a local park, officials said.

Officer Randolph Holder, 33, a Guyanese immigrant and five-year veteran of the force, was shot in the head when he and his partner confronted one of the suspected gang members who had robbed a man of his bike in an attempted getaway at East 102nd Street and the FDR Drive about 8:30 p.m., sources and police officials said.

"We're all in mourning tonight. The whole city is mourning," Mayor Bill de Blasio said at a press conference late Tuesday night.

"We are humbled by Officer Randolph Holder's example, an example of service, courage and sacrifice. We offer our prayers to his family."

Holder, who was assigned to protect public housing in Police Service Area 5, died at 10:22 p.m. in Harlem Hospital, according to NYPD Commissioner Bill Bratton.

The events leading up to the officers death began with shots traded between two groups at 420 E. 102nd St. in the East River Houses, Manhattan Chief of Detectives William Aubry.

Officers on the roof of the housing complex saw the shooting and called for help, he said.

When responding officers arrived, the group scattered and the suspected shooter, Tyrone Howard, 33, fled across the FDR and headed north toward the Wagner Houses where community activists said he was being harbored to avoid arrest on an outstanding warrant.

As he fled on the Harlem River promenade, Howard robbed a bystander of his bike and continued his flight on the bicycle, the chief said.

At the same time, Holder and his partner, who had responded to the call, stopped three men on the footbridge connecting Manhattan and Randall's Island. As they returned to the Harlem side of the bridge at 120th Street after determining the men were not involved in the shooting, they ran into Howard making his getaway.

The suspect, who served two stints in state prison and was wanted on an outstanding warrant connected to a Sept. 1 shooting, got off his bike and fired at the officers fatally striking Holder in the head.

Howard fled on foot but was captured by additional officers a short time later, Bratton said. The unidentified suspect had gunshot wounds to his leg.

He was taken to New York Presbyterian-Weill Cornell Medical Center, but was expected to be discharged into police custody Wednesday morning, Bratton said.

Howard served two separate state prison terms — about five years behind bars — on drug possession charges.

Three other men were in custody and being questioned about the incident, Bratton said.

A gun was recovered at the scene, sources said, and NYPD divers in the Harlem River recovered a loaded magazine containing 30 bullets.

Dave Wilkins, who lives at the nearby Wagner Houses, said he heard gunshots and saw officers swarm the FDR Drive in the immediate aftermath.

"I heard seven shots, 'Bop! Bop! Bop!' It was rapid fire. It sounded high caliber,” Wilkins, 37, said. "The officer was on the overpass. They put him on a stretcher. Cops were surrounding him. It looked like One Police Plaza."

"It was sad to see. I feel sorry for his family. Why would a man or kid do that? You shot a cop for what?"

Holder's father and grandfather had both served as policemen in Guyana, Bratton said.

"We ask all New Yorkers of good will to remember our fallen brother, Randolph Holder, and to keep his family, friends and colleagues in your heart, thoughts and prayers," Patrolmen's Benevolent Association President Patrick Lynch said.

Holder's body is being brought to Jeremaiah C. Gaffney's Funeral Home in Inwood.

Funeral services are scheduled for Wednesday, Oct. 28 at 3 p.m., with a viewing scheduled for Oct. 27 at 9 a.m., and has been moved to the The Greater Allen A.M.E. Cathedral of New York at 110-31 Merrick Blvd. in Jamaica, multiple sources confirmed.

The wake and funeral was originally scheduled for the Church of the Nazarene in Far Rockaway, but it could not accommodate the thousands of mourners expected to pay their respects to Holder.

DNAinfo is New York's leading neighborhood news source. We deliver up-to-the-minute reports on entertainment, education, politics, crime, sports, and dining. Our award-winning journalists find the stories - big or small - that matter most to New Yorkers.