President Obama will cut short his European trip to visit Dallas early next week, after a sniper killed five police officers Thursday night in that city, according to the White House.

The president will visit on the invitation of Dallas Mayor Mike Rawlings, also said the White House, which stated it will release more details about the trip as soon as they are available.

Police have identified the shooter as Micah Johnson, a black Army veteran purportedly upset about two recent incidents in which a police officer fatally shot a black male.

In all, 12 officers were shot in the sniper attack.

Obama condemned the shooting of the black males, in Minnesota and Louisiana, then the police shootings, saying Friday from Poland: "There is no possible justification for these kinds of attacks or any violence against law enforcement. … Anyone involved in the senseless murders will be held fully accountable. Justice will be done."

Obama will return on Sunday to Washington, one day earlier than planned. He will travel on Saturday from Warsaw, Poland to Madrid, Spain, then participate Sunday in meetings with his Spanish counterpart and other government officials and later go to the Northern Mariana Island of Rota, as previously scheduled, to speak with U.S. military personnel serving there.

However, his visit to Seville, Spain, was cancelled for the early departure.

The Associated Press contributed to this report.