An NYPD officer shot early-morning Sunday was killed by friendly fire in what police described as a "violent struggle" with an armed man in the Bronx, the city police department confirmed Monday afternoon.

"This was an absolute tragedy," Police Commissioner James O'Neill said at a news conference at Police Headquarters. "Caused by a convicted felon with a loaded firearm."

Police said responding officers shot in the direction of where Brian Mulkeen, 33, and the armed suspect Antonio Lavance Williams, 27, were wrestling on the ground with another officer.

During that struggle, O'Neill said, Mulkeen fired five rounds at the suspect and his fellow officers fired 10 shots, two of which struck Mulkeen.

Sources said Mulkeen was shot in the back of his head, leg, and torso. O'Neill said all the shots were fired in just 10 seconds, and Mulkeen was wearing a bulletproof vest.

Mulkeen was pronounced dead at Jacobi Medical Center, where an emotional tribute took place Sunday morning as several officers lined the hospital driveway.

Police did not confirm which shots struck Williams, whom was pronounced dead at a local hospital.

Officials said Mulkeen, along with four officers and a sergeant with the Bronx Borough Anti-Crime Unit, were patrolling near the Edenwald Houses around 12:30 a.m. Sunday because there was gang activity and recent shootings in the area.

Police said Mulkeen and the other officers, all of whom were not in uniform, tried to stop two men at East 229th Street near the Edenwald Houses. Two officers chased Williams after he fled on foot.

During the struggle with officers, the NYPD said, Williams reached towards his waistband. A loaded .32-caliber revolver was recovered at the scene. Authorities said it belonged to Williams but it had not been fired.

Patrick Lynch, the president of the Police Benevolent Association union for uniformed officers, blamed Williams for Mulkeen's death.

"Anybody who wants to play the 'blame the cops' game with this tragedy needs to swallow their rhetoric and look at the facts," Lynch said in a statement. "That perp is the one who carried an illegal gun onto our streets. He is the one who chose to fight with the cops. He is solely responsible for our hero brother’s death."

The police department is investigating body camera footage. Six officers were at the scene and wore body cameras, all of which were active except Mulkeen's; O'Neill said the officer didn't get a chance to activate his.

Mulkeen is the second member of the NYPD to be killed in the line of duty this year. NYPD Detective Brian Simonsen was also killed by friendly fire in February, struck by a hail of police gunfire in February after responding to a reported robbery in Queens. Two men face multiple charges for the reported robbery that led to the shooting.

Police said the officers involved in the shooting will be provided access to counseling.

The police department said it will review its policies and try to learn from mistakes in the wake of the friendly fire shootings. NYPD officials said it released a training video on how officers should respond to an armed robbery scene after Simonsen was killed.

Mulkeen had been on the job nearly seven years. Officials say he leaves behind a girlfriend who is also an NYPD officer.

Mulkeen served in the Bronx Borough Anti-Crime Unit. NYPD brass said he was a fine officer dedicated to his job, and even made a gun arrest Friday night.

He was also a 2008 graduate of Fordham University, where he was a track and field star and a championship weight thrower.

The school's president, highlighting Mulkeen's sacrifice, said, "Brian Mulkeen went out into the world to do exactly what we expect of our alumni — be a man for others — and he was slain in service to the local community."

Mayor Bill de Blasio has ordered all flags be flown at half-staff until further notice, following Mulkeen's death. He asked all New Yorkers to keep his family in their thoughts.

"This is a young man who made the choice to join the NYPD, to put his life on the line, to protect others. When we met with his family, and one of the things they told us even with their grief, was that Brian made a choice, an incredibly noble choice," de Blasio said.

Meantime, the organization Answer the Call, which provides funds to families of NYPD and FDNY members who have died, will donate $25,000 to Mulkeen's family to help with immediate expenses.

Mulkeen's body has been transported to a funeral home in his hometown of Monroe in upstate New York. A wake is scheduled for Thursday. Funeral services are set for Friday.