NEW YORK (Reuters) - A New York City police officer was shot dead early on Wednesday morning by a gunman who was killed by police as he ran from the scene, an attack the city’s top police official called an assassination.

The officer, Miosotis Familia, 48, a 12-year veteran of the force, was shot in the head as she sat in a mobile command truck in the Bronx borough with her partner at about 12:30 a.m. EDT (0430 GMT), the New York Police Department said.

“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 told a news conference. Earlier on Twitter, he said that Familia had been “assassinated.”

Police said that alleged gunman Alexander Bonds, 34, shot Familia through the vehicle’s window, hitting the mother of three in the head. Bonds fled and was shot dead about a block away by two officers after he drew a handgun, according to police.

A bystander was shot and wounded during that encounter, O’Neill said. He said the person, who was not identified, was in stable condition at a nearby hospital.

Bonds had been arrested six times, including once in 2001 for assaulting a police officer, said NYPD spokesman Detective Ahmed Nasser. Bonds pleaded guilty to second-degree misdemeanor assault and was sentenced to community service, according to a Queens county court official.At the time of Familia’s shooting, Bonds was on parole after being convicted of a robbery in Syracuse, New York, according to a police source.

Bonds’ social media history included an anti-police rant, posted in a Facebook Live video in September.

Slideshow ( 16 images )

“That ain’t no badge of honor or nothing,” Bonds said in the video. “I don’t care about a 100 police watching this shit.”

The shooting was similar in style to the December 2014 ambush of two New York City police officers who were slain as they sat in a patrol car by a man who traveled to the city from Baltimore after promising to kill officers.

A total of 24 U.S. law enforcement officers have been killed by gunfire so far this year, a 9 percent increase from the same period in 2016, according to the National Law Enforcement Officers’ Memorial Fund.

The president of the city’s Patrolmen’s Benevolent Association union, Patrick Lynch, condemned the attack. “Violence against police officers cannot stand,” he said.