Emergency personnel seen Wednesday near the scene where a police officer was shot in the Bronx section of New York. AP Photo/Seth Wenig A New York City police officer was fatally shot early Wednesday in the city's Bronx borough by a gunman who was then shot to death by the police as he ran from the scene, authorities said.

The officer, Miosotis Familia, 48, a 12-year veteran of the force, was shot as she sat in a police vehicle with her partner at about 12:30 a.m. ET, the New York Police Department said.

An assailant fired through the vehicle's window, hitting Familia in the head, the police said in a statement.

"It is clear that this was an unprovoked direct attack on police officers who were assigned to keep the people of this city safe," the New York police commissioner, James O'Neill, said.

Familia was taken to Saint Barnabas Hospital, where she was later pronounced dead, the police said.

Officers chased the attacker on foot for a block before he drew a revolver and they fatally shot him, the police said.

A bystander was also shot and was in stable condition at a hospital, according to the department.

Twenty-four US law-enforcement officers have been killed by gunfire this year, a 20% increase from the same period in 2016.

Familia is the eighth New York City police officer shot to death in the line of duty over the past five years. Two New York City police officers were ambushed by a killer in December 2014.

(Reporting by Brendan O'Brien in Milwaukee; Editing by Larry King and Jeffrey Benkoe)