Image copyright AP

The evening started peacefully. Dallas police officers tweeted photos of themselves alongside protesters demonstrating against the police shootings of black men in Louisiana and Minnesota.

Then came a hail of bullets that left five police officers dead and several others injured.

The days of bloodshed left Americans reeling, and yet again questioning how to mend the fractured relationship between US police officers and many black Americans.

Among them were police officers across the country, for whom this anguish was all too familiar.

"My heart is heavy, I feel like I've been punched in the stomach repeatedly," says one serving police sergeant based in Ohio, who asked to remain anonymous. "I feel like I'm fighting a losing battle right now, people want me dead for my occupation."

Image copyright Twitter

As people struggled to understand how to stop the violence, attention also turned to the tension and threat many police officers say they operate under.

Current and former officers described how they felt vulnerable and under siege amid heightened community suspicion.

"I've been a cop for 14 years... Never did I ever feel under threat back then as I do now," the Ohio police sergeant says.

"The past two years have been the worse of my career with threats and people attempting to make promises of those threats. ... I knew that this could happen, I knew people wanted me dead, but never had something like this happen before. Yesterday's thoughts are today's reality."

For Gerard Kane, a retired New York Police Department (NYPD) sergeant, the week's events brought back painful memories. He was with a fellow officer who was pushed of a roof during a struggle with a suspect following a robbery at a McDonald's back in 1989.

"I am physically sick over this," he says. "I am a 9/11 survivor and was with an officer killed in the line of duty in 1989, and these events have caused the emotions I felt in 1989 and 2001 to come flooding back."

The massacre in Dallas is the worst mass shooting of police officers since 1932, and brought the number of on-duty officers shot and killed this year to 26 . As a comparison, on average between three and four officers have been killed annually in the UK since World War Two, excluding those killed during the Troubles in Northern Ireland.

More than a third of those shot in the US in 2016 have died in ambush attacks, concealed or surprise assaults designed to catch them off guard.

But Graham Campbell, another former NYPD officer, says Dallas was a particularly hard hit for those who work in law enforcement.

"Being killed in the line of duty is a fact of life for cops and they take the job knowing that," he says. "I think though that most cops feel that they can do things to mitigate this risk through tactics and their ability to talk to people.

"What makes this different is that there's nothing to mitigate this. Cops have been ambushed when they arrived at calls sure, but this is different again. It was at an event that they were ordered to be at."

As officers across the country turned up for their shifts in the days that followed, many were facing the reality of how much work needs to be done to heal the rifts with the communities they work in.

Image copyright AP Image caption Prominent activist DeRay Mckesson was among people detained in Baton Rouge on Saturday but was released on bail the next day

Protests against the deaths of Philando Castile in Minnesota, and Alton Sterling in Louisiana continued across the US over the weekend. In some places they broke out into sporadic clashes and culminated in the arrest of hundreds of activists.

"I'm a black man, I get the frustration and the anger [about shootings by police]," says a serving police sergeant, who leads a small team of officers in Michigan but spoke on the condition of anonymity because his force does not permit him to speak openly to the media.

"Unfortunately there have been some officers who have screwed up... there are officers who should not be doing this job. There's no doubt about that.

"But people have to understand you can't taint all officers with the same brush."

He says officers feel unsupported by city officials and politicians, who he says are too quick to question use of force before understanding the facts of a case. And police often feel vilified by the communities they serve.

"I too am someone's son, someone's uncle, and at the end of the day, when I take off the uniform I'm still a black man," he says. "For me it's hard. I know the job I do…. People should support black officers but I feel ridiculed, mocked and degraded for what I do by my own people.

"They expect us to be punching bags. They expect us to be more human than they are. But we too have emotions. I do not come to work to be a punching bag, I come to work to keep the peace."

As many struggled to see the right way forward, some officers warned of the effects of escalating anxiety.

Robert T Christensen, a former police officer in Kalamazoo, Michigan, now teaches about the use of force at a police academy.

He says increasing media focus on cases of excessive police violence, especially towards minorities, is leaving officers questioning their positions.

"Police feel like, 'Why should I even try? ... Do I really want to go to work? I'm hated because of the few bad decisions by other police officers across the country.'

"It's a war on police fuelled by hatred and a systemic problem of police officers using deadly force in questionable circumstances."

Image caption Robert T Christensen trains police recruits on when to use deadly force

Watching video footage of the Dallas officers "dropping like flies" left him with a sense of desperation about the whole country's future.

"I felt like the fabric of our nation was being ripped apart in front of my eyes. We seem to be so divided on every level, and it's everybody's fault," he says.

"But murder is not the answer. Gunning down police officers is not the answer. It's only going to make things worse and create conflict, anxiety and fear among the police and the general public."

Graham Campbell says there is a "desperate need" for more dialogue between police officers and the community.

Media playback is unsupported on your device Media caption Millennials worry about what's in store for the next generation of black Americans

"I think that people don't understand what cops really see day in and day out. And that cops often lose sight of the vast majority of good and hardworking people who they serve."

Without this, he is worried about more violence in the future.

"I think that situations where cops are killed do make them more cautious and apprehensive, which can lead to the use of force," he says. "[As an officer] you can use your brain 80% of the time to get out of trouble.

"But I think the latest events will probably mean less patience for people yelling 'Hands up don't shoot' at crime scenes."