A New York City police officer was shot and killed in an “unprovoked attack” as she was sitting in a police vehicle early Wednesday, authorities said.

Officer Miosotis Familia was sitting inside the vehicle with her partner at 12:30 a.m. in the Bronx when a gunman fired through a window and struck Familia in the head, police said. The city’s police commissioner called the shooting an assassination.

Familia, a 12-year NYPD veteran, was taken to a hospital in extremely critical condition, police said. Police Commissioner James P. O’Neill announced on Twitter several hours later that Familia had died. Familia’s partner was not injured in the attack.

“Based on what we know right now, this was an unprovoked attack against police officers who work to keep this great city safe,” O’Neill said at a news conference early Wednesday.

O’Neill tweeted: #NYPD PO Miosotis Familia has been assassinated in an unprovoked attack on cops assigned to keep NYers safe. Keep her family in your prayers

Familia was wrapping up her shift when the gunman fired, police said. “My partner’s shot! My partner’s shot! My partner’s shot! Hurry up central!” Familia’s partner was heard screaming into a police radio, according to the Associated Press.

Two other officers confronted the suspected gunman about a block away from the scene of the shooting, police said. The shooting suspect was shot and killed after he drew a silver revolver, police said. He was identified by authorities as 34-year-old Alexander Bonds.

A bystander was shot during that encounter. Police said that person is in stable condition.

It remains unclear what prompted the attack, officials said. A police spokesman said Familia did not know Bonds. The AP reported that Bonds had been on parole for a robbery case in Syracuse.

Chuck Schumer tweeted: Woke to the terrible news that Officer Miosotis Familia was shot & killed in the Bronx overnight. God bless her family & the NYPD.

The shooting was reminiscent of the 2014 deaths of two New York police officers who were shot at point-blank range while sitting in a police car in the East Flatbush neighborhood in Brooklyn.

“It’s clear that this was an assassination,” New York City Mayor Bill de Blasio said at the time. “These officers were shot execution-style, a particularly despicable act which goes to the heart of our society and our democracy.”

Authorities said the gunman in the 2014 double-ambush had declared his intention on Instagram to kill officers as retribution for the deaths of Michael Brown and Eric Garner, black men who were killed by police that year.

The Dec. 20, 2014, deaths of NYPD Officers Wenjian Liu and Rafael Ramos inflamed tensions between the city’s police force and de Blasio, who during his 2013 mayoral campaign had strongly criticized the department’s “stop-and-frisk” tactic. After the ambush, police union officials accused the Democratic mayor of feeding anti-police sentiment. The rift prompted hundreds of police officers to turn their backs as de Blasio spoke at the funeral of one of the two slain officers.

In 2016, law enforcement fatalities spiked to their highest level in five years, with 135 officers killed in the line of duty, according to the National Law Enforcement Officers Memorial Fund, a nonprofit group that monitors line-of-duty deaths. The rising death toll rattled police officers nationwide.

Ambushes dominated the news after a pair of July 2016 attacks in which eight officers were gunned down in what authorities described as targeted attacks fueled by anger over how police use force on minorities.

An ambush in Dallas on July 7 – the deadliest single day for law enforcement since the Sept. 11, 2001, terrorist attacks – targeted officers patrolling a protest against deadly police shootings in Baton Rouge and Falcon Heights, Minnesota, over the preceding days. Five officers were killed and nine others wounded before police killed the attacker.

Ten days later, another attacker sought out law enforcement officers in Baton Rouge, killing two police officers and a sheriff’s deputy before he was felled by a sniper. Officials said in a report released last week that the gunman had researched the officers involved in the deadly shooting of Alton Sterling, a black man killed outside a Baton Rouge store in an incident partially captured on video.

In November, two Iowa police officers sitting in their squad cars were also killed in a pair of ambush attacks. A San Antonio officer writing a ticket was ambushed and killed not long after.

These episodes helped fuel an uptick in police officer deaths last year, with 64 officers fatally shot, a 41 percent increase from the previous year, according to the Memorial Fund. Nearly one in three officers fatally shot was killed in what were deemed to be ambush attacks like those in Dallas and Baton Rouge.

Overall, law enforcement line-of-duty deaths have declined since the 1970s, when twice as many police officers were fatally shot each year and twice as many officers were killed annually. Still, in recent years, police have said they feel demonized by protests against how law enforcement officers use deadly force. Demonstrations have erupted in cities such as New York, Baltimore, Cleveland, Cincinnati, Chicago and San Francisco after high-profile killings by officers.

Before 2016, traffic-related incidents – rather than shootings – were the leading cause of police deaths for most of the last two decades. Last year, nearly half of all police officer deaths were gun-related, the largest share in any year since 1994.

Andrew Cuomo tweeted: I offer my deepest condolences to Officer Familia’s loved ones and fellow members of the NYPD. Today, we all mourn one of New York’s Finest.

So far this year, at least 65 officers have been killed – a 25 percent increase over the same period last year, according to the Memorial Fund. Nearly half of them were killed by gunfire, but the overall increase in fatalities was largely fueled by what the fund called “other causes,” which can include boating accidents and illnesses.

Familia, 48, joined the New York Police Department in July 2005. She was a mother of three, said Patrick J. Lynch, president of the Patrolman’s Benevolent Association.

In a statement, Lynch said of Familia:

[She] gave her life protecting a neighborhood that had been plagued by gang gun violence. 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. As we mourn her death and support her family, friends and colleagues, we ask for your help. Violence against police officer cannot stand. When you see or hear someone making threats against NYC police officers you need to let us know, you need to be our eyes and ears.