Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A New York City police officer was shot to death early Wednesday, ambushed in a marked police truck and "assassinated in an unprovoked attack" by a man with a revolver who was later killed by officers, police said.

Officer Miosotis Familia, a 12-year member of the department, was wrapping up her shift when the man fired one round through the passenger-side window and struck her in the head. She was rushed to a hospital but did not survive.

"This was an unprovoked direct attack on police officers who were assigned to keep the people of this city safe," Police Commissioner James O'Neill said, calling it an assassination.

Her partner radioed for help.

"Shots fired! 10-85!" the officer is heard frantically shouting after the gunfire, including the code for an officer down. "My partner's shot! My partner's shot! My partner's shot! Hurry up central!"

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Officers responded fast, and caught up to the suspect, 34-year-old Alexander Bonds, about a block away, police said. As they confronted him, he pulled a revolver, and police fired, striking and killing him. A silver revolver was found at the scene. A bystander was hit in the stomach by a bullet during the standoff and is in stable condition, police said.

New York Police Officer Miosotis Familia NYPD

Familia had been stationed in a mobile command post, a RV-sized truck used as a communications hub during major events, like the Fourth of July. She had been looking down, writing in her memo book, a police log where officers record their shift activity, when Bonds walked up.

Bonds, who also went by John Bonds, had been on parole for a robbery case in Syracuse, New York, but was from the Bronx, police said. He is seen in surveillance footage marching up to the post "with purpose," officials said, but it's not clear what provoked the attack.

The shooting recalled the Dec. 20, 2014 killing of patrol officers Wenjian Liu and Rafael Ramos, who were ambushed and shot to death in their vehicle without warning by a man who approached the passenger window of their marked police car. The suspect, 28-year-old Ismaaiyl Brinsley, then fatally shot himself. Brinsley announced online in the moments before the shooting that he was planning to shoot two "pigs" in retaliation for the police chokehold death of Eric Garner.

Alexander Bonds, also known as John Bonds, in an April 10, 2013 booking photo. New York State Department of Corrections via AP

Mayor Bill de Blasio, speaking at the hospital before she died, asked that the city keep her in their thoughts.

"She was on duty serving this city, protecting people, doing what she believed in and doing the job she loved," he said. "And after this shocking and sudden attack, her fellow officers came to her aid immediately."

Officers saluted at attention outside the Bronx hospital as the ambulance and police motorcade escorted Familia's body from the hospital. Familia had three children and had been a member of the anti-crime unit.

"Fully knowing the dangers that she faced, she suited up in uniform every day and stood tall against those who threaten and terrorize the good folks of the Bronx," said Patrolman's Benevolent Association president Patrick Lynch.

An NYPD vehicle with a cracked window sits on the scene where a police officer was fatally shot in the Bronx section of New York. Seth Wenig / AP

The Bronx neighborhood was blocked off with police tape as officers investigated the deadly shooting. Police were combing for any other surveillance footage and talking to witnesses.

Witness Jay Marzelli told the Daily News of New York he thought the shots Wednesday were fireworks at first.

"I was in this bodega right here on Creston, just getting a sandwich and all of a sudden there was all this running and stuff going on, and I look out probably 40, 50, 60 cops screaming, 'Call a paramedic, clear the block!'" he said. "It looked like there was a riot going on, and two seconds later I hear gunshots, 'Bam, bam,' and then the police officer was just laying there."