A gunman walked into a police station in the Bronx and started shooting, wounding an officer just hours after a similar unprovoked attack that injured a different officer in a patrol van.
The officer was shot on Sunday morning at the headquarters of the 41st police precinct, NYPD spokesman Hubert Reyes said.
He said the injured officer is in a stable condition at Lincoln Hospital.
Police officials confirmed the gunman is in custody.
In one of them, a man is seen sauntering into the precinct house lobby, before briefly disappearing off screen.
Then, he rushes into a side room with his arm extended, as if pointing a gun, as two people inside run away.
In another video from a different angle, an officer in the precinct lobby is seen reacting to a sound.
Officers converge, pointing their guns, and the gunman can be seen at a distance falling to the ground, a gun sliding away from him across the floor. Other officers quickly gather around the man.
Two officers narrowly escaped with their lives when a gunman fired into their patrol van just before 8.30pm on Saturday.
The officer at the wheel of the van was grazed in the chin and neck but he avoided serious injury.
He was expected to released from the hospital on Sunday.
Police Commissioner Dermot Shea said at a late night news conference that the attack “should outrage all New Yorkers.”
“He is lucky to be alive,” Mr Shea said. “He is expected to make a full recovery and it is a miracle.”
New York Governor Andrew Cuomo said in a tweet on Sunday that he was “horrified by the multiple attacks” on police.
“NY’s law enforcement officers put their lives on the line every day to keep us safe,” he said.
“These attacks are heinous.”
Mayor Bill de Blasio, a Democrat, condemned the back-to-back attacks.
“This vicious assassination attempt is the second one we’ve seen in 24 hours – and an attack on our NYPD officers is an attack on ALL New Yorkers,” Mr de Blasio tweeted Sunday.
“This despicable hatred is an attempt to divide our city and undermine our safety. We cannot and will not let that happen.”
The two uniformed officers, partners for eight years and friends since middle school, were sitting in their van with emergency lights activated when a man approached them and engaged them in conversation, Mr Shea said.
The man asked the officers for directions, then pulled out a gun “without provocation,” the commissioner said.
The man fired multiple shots, striking the officer behind the wheel.
Mr Shea said the officer’s carotid artery narrowly avoided injury.
Neither officer returned fire. The officer’s partner drove him to a hospital nearby.
Mr Shea called both officers “heroic” for their composure and said their long association made for “an amazing story.”
Security video that appeared to capture Saturday night’s shooting shows the van driving quickly away as a man appeared to point something at the fleeing vehicle.
The officers had been stationed in the neighbourhood because of recent drug activity and violence, Mr Shea said.