A security guard stands at attention as New York Police Department officer Miosotis Familia is memorialized before the start of a baseball game between the New York Yankees and the Toronto Blue Jays Wednesday. (Kathy Willens/AP)

New York City officials were investigating whether a parolee’s anger at police led him to shoot and kill a veteran police officer in an early-morning ambush that authorities described as an assassination.

Alexander Bonds, on parole since 2013 after serving seven years in prison for robbery, approached Officer Miosotis Familia’s vehicle in the Bronx at 12:30 a.m. Wednesday and fired through the window, striking Familia in the head, police said.

Familia, a 12-year New York Police Department veteran, was inside the large vehicle, known as a mobile command post, at the time of the shooting and was taken in extremely critical condition to a hospital where she later died. Her partner was not wounded in the attack.

Two other officers shot and killed Bonds, 34, about a block from the scene of the shooting after he drew a revolver, police said. A bystander was shot during that encounter and was listed as stable, police said.

Familia was “unjustly targeted and murdered in a cowardly, unprovoked attack,” Attorney General Jeff Sessions said in a statement Wednesday afternoon. “She will be remembered for her years of service and for the example of selflessness that she set protecting people on our streets.”

(The Washington Post)

A police spokesman said Familia did not know Bonds.

Ten months earlier, Bonds posted an 11-minute video to his Facebook page that complains about mistreatment at the hands of officers during his incarceration, and he suggested that he would fight a police officer if he encountered one on the street.

In addition to the robbery, Bonds served more than six months in prison in 2004 for selling a controlled substance.

“I’m not playing, Mister Officer. I don’t care about a hundred police watching this s---. You see this face. You see this face or anything, leave it alone. Trust and believe,” he said in the video.

“I’m not hesitating. It ain’t happening,” Bond added. “I wasn’t a b---- in jail, and I’m not going to be a b---- in the streets.”

A law enforcement official told The Washington Post that the NYPD believes the video to be authentic and is investigating it further.

The shooting was reminiscent of the 2014 killings of two New York police officers who were shot at point-blank range while sitting in a police car in Brooklyn. The gunman in that 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.

“It’s clear that this was an ­assassination,” New York Mayor Bill de Blasio (D) 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.”

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. Of those, 64 officers were fatally shot, a 41 percent increase from the previous year, according to the Memorial Fund. Nearly 1 in 3 officers fatally shot was killed in what were deemed to be ambush attacks.

Two ambushes in July 2016 largely contributed to the increase: In Dallas, a gunman targeted officers patrolling a protest over deadly police shootings of civilians, killing five officers and wounding nine others.

Ten days later, an attacker in Baton Rouge killed two police officers and a sheriff’s deputy before he was fatally shot by a sniper.

In November, two Iowa police officers sitting in their squad cars were 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.

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.

New York Police Commissioner James O’Neill announced Familia’s death in a post on Twitter early Wednesday, writing “#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, 48, was a mother of three, said Patrick J. Lynch, president of the Patrolmen’s Benevolent Association.

Vivian Gomez, who lived in the same Bronx apartment building as Familia, said Wednesday that she would often see Familia in passing.

“When our paths crossed, she was either coming to or from work. I know she loved the job,” Gomez told The Post. “I never heard her say a negative thing about her job. Oftentimes, people would gripe about the hours, the long days. I never heard her say, ‘I dislike my job’ or ‘It’s tough.’ She always had a smile on her face.

“I know there’s a lot of distress about lack of justice in our community,” Gomez continued. “She’s a real face behind the badge.”

Wesley Lowery and Julie Tate contributed to this report.