ABC News July 20, 2016

Routine Violence and Targeted Attacks Won't Keep Cops From Doing Their Jobs

WATCH: Kansas City Police Mourn Officer Killed in Line of Duty

Deadly, targeted attacks on law enforcement officers in Dallas, Texas, and Baton Rouge, Louisiana, within a span of 10 days have drawn national attention to the dangers of being a cop. But former New York City Police Department Commissioner and ABC News consultant Ray Kelly doesn't think the current climate impacts officers' productivity at work.

While it "probably strikes most of us differently depending on how much time you've had as a police officer," he told ABC News today, "this is part of the whole role of police officers. They're going to lose fellow officers as they go forward in their careers, not unlike the military.

"But you have to continue to do your job. And I think that's what we see and what we'll continue to see," Kelly added.

Here is Kelly's take on targeted attacks and the daily dangers of being a cop.

Kansas City Police Captain Dies in Shooting After Going to Scene to Help Other Officers, Police Say Critically Injured East Baton Rouge Deputy Is 'Fighting for His Life,' Sheriff Says Slain Dallas Police Officers Mourned at Funerals

The Targeted Attacks

In Baton Rouge, three law enforcement officers were killed July 17 by a gunman who "intentionally targeted and assassinated" cops, according to police. The attack came in the wake of the death of Alton Sterling, a black man who was shot and killed during an altercation with Baton Rouge police officers on July 5. Protesters took to the streets nationwide after video surfaced of the encounter, which was followed the next day by a video of the fatal police shooting of Philando Castile, another black man, in Minnesota.

The Baton Rouge attack was also 10 days after the killing of five officers in Dallas by a gunman who said he was angry at police.

Kelly says cops in Baton Rouge and Dallas have since been "performing admirably."

"When you lose ... your colleagues, it's gut wrenching. You may know them personally, you know their families. And of course you will have some anxiety yourself, understandably," Kelly said, but "they will continue to do their job."

Smiley N. Pool/The Dallas Morning News/via Reuters
Dallas Police respond after shots were fired at a Black Lives Matter rally in downtown Dallas, Texas, July 7, 2016.

Kelly also praised the Dallas and Baton Rouge police chiefs.

"They have, I think, supported their officers and raised the comfort level of the citizens," he said.

Police departments around the country are on high alert in the wake of the targeted attacks.

In New York, the NYPD released new measures Sunday -- the day of the Baton Rouge attack -- announcing dual patrols. Kelly says the advantage of doubling up is that single officers are easier to attack.

However, dual patrols "put a strain" on small- or medium-sized departments, he said, because it reduces resources.

Drew Angerer/Getty Images
Members of the New York City Police Department stand guard in Times Square, July 15, 2016 in New York City.

The NYPD also said this week its Critical Response Command is staffing security posts “visible with helmets and long guns” at stations throughout the city.

"It's put in place to act as a deterrent to anyone who may want to attack police officers," Kelly explained.

"I think that there's no specific threat," he said, but the precautions are in place as an "additional effort to secure our police facilities" and "to raise the comfort level of police officers working in that facility."

Daily Dangers of Being a Cop

Targeted shootings aren't the only dangers.

In Brooklyn, New York, Tuesday night, shots were fired from a passing car at two NYPD officers who were walking. The shots narrowly missed the officers, The Associated Press said.

And in Kansas City, Kansas, Tuesday, a police captain died after he was shot while responding to help officers at a call. This was not a planned ambush, officials said, adding that it appeared the suspect had committed a crime and fired to try to avoid being apprehended.

"Our officers do have some stress and increased anxiety," Kansas City Police Chief Terry Zeigler said at a new conference today. "There's no way they couldn't." But Zeigler added that the "officers will continue to fight for the safety of our community."

Kelly says the everyday dangers of being an officer can differ depending on the setting -- urban or rural -- but there is "always potential for the unexpected."

Kena Betancur/Getty Images
NYPD officers patrol during a protest, July 8, 2016 in New York City.

There are some calls "that historically create more of a problem," he said, like domestic violence calls -- "oftentimes the parties engaged in a domestic dispute will turn on the officer," Kelly said.

Or when weapons are involved -- which "have potential for the officer to get injured," he said.

Traffic stops are also dangerous, Kelly said, because "you don't know who is in the car" you're approaching. Officers can also be injured by passing cars.

And in large cities, guns and assaults in progress are big factors.

"Disputes can turn against the officer pretty quickly," Kelly said. "Anything where action is ongoing ... the danger is there."

For police, the unknown is dangerous, Kelly said.

"Virtually any 911 assignment can, first of all, not be what the caller describes, and secondly, can change very quickly," he said. "So officers have to be aware of that and on guard to a certain extent."

Ray Kelly's Takeaway: Cops Won't Be Deterred

Spencer Platt/Getty Images
New York Police Commissioner Raymond Kelly speaks during a news conference in New York City, April 25, 2013.

"There is an element of danger," Kelly said. "That goes along with police work ... I think people in the business realize that."

But he stressed that he's never seen that impact officers' performance "in any way."

"They go where the problems are, while the rest of the world is going in the other direction," he said.

In terms of the psychological impact, he said he thinks it's "not as great as people outside of policing may think."

"I think police officers handle it pretty well. They have to have a fairly resilient demeanor to see what they see on a regular basis," he said.

"This is what they do. This is their livelihood. So you get used to it to a certain extent," he said. "And this is a self-selecting business. If the impact on you psychologically [is in] a negative way consistently, perhaps you should find another business."

So while officers throughout the country have a "heightened awareness," Kelly says recent events are "not going to deter them."