Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

President Barack Obama expressed his ongoing frustration with U.S. gun laws Friday following the deadly ambush-style sniper shooting of five police officers in Dallas.

Five law enforcement personnel were killed and six others were injured after at least two gunmen opened fire in the city's downtown area. The incident happened during a demonstration over two police shootings of black men in Louisiana and Minnesota this week.

"When people are armed with powerful weapons, unfortunately it makes attacks like these more deadly and tragic," Obama told a press conference during a trip to Poland. "In the days ahead we're going to have to consider those realities."

President Barack Obama delivers remarks on the police shootings in Dallas after meeting with EU leaders at the NATO Summit in Warsaw, Poland, on Friday. Jonathan Ernst / Reuters

The president called the shootings "a vicious, calculated and despicable attack on law enforcement" and said he was "horrified" at the "senseless murders."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

He said that while the "twisted motivations" of the killers would become clear in time, "there is no possible justification for these kinds of attacks or any violence against law enforcement."

One of the five officers killed has been identified as 43-year-old Brent Thompson of the Dallas Area Rapid Transit authority. The other four were from the Dallas Police Department but were not immediately named.

"Today is a wrenching reminder of the sacrifices that [police officers] make for us," Obama said. "Police across America, which is a tight-knit family, feels this loss to their core and we're grieving with them."

Obama was visiting Poland for the NATO summit Friday. After landing Thursday, hours before the Dallas attack, he said the officer-involved deaths in Louisiana and Minnesota were part of "a broader set of racial disparities that exist in our criminal justice system."

He referenced those comments again Friday but noted it was equally important to acknowledge "the police have an extraordinarily difficult job and the vast majority of them do their job in outstanding fashion."

It is not the first shooting to which Obama has responded by expressing his frustration over Americas gun laws.

Following the Orlando nightclub shooting in June, he said: "Our politics have conspired to make it as easy as possible for a terrorist ...to buy extraordinary powerful weapons and they can do so legally."

Lawmakers continue to be locked in a partisan battle over gun control legislation. Republicans have accused Democrats of trying to violate the Second Amendment, while Democrats say the GOP is bending to the gun lobby.