The White House said Tuesday that no politician, including the president, should be blamed when someone “acts out their evil intention” — as President Trump prepares to travel on Wednesday to the Texas and Ohio cities where 31 people were killed in mass shootings over the weekend.

​”There are plenty of people in this country who commit acts of evil in the names of politicians, of celebrities and all types of things​,” White House spokesman Hogan Gidley told reporters. “​It’s not the politician’s fault when someone acts out their evil intention.​”

He said they wouldn’t think of “blaming” Sen. Elizabeth Warren for Sunday morning’s shooting in Dayton, Ohio, that killed nine people after it was revealed the gunman was a supporter of the Democratic presidential candidate.

Gidley also said Rep. Alexandria Ocasio-Cortez shouldn’t be held responsible for the actions of a man who ​”perpetrated a terrorist attack​” on a Homeland Security detention center last month in Washington after the New York Democrat called for disbanding the federal agency and describing such facilities as concentration camps.

He also referred to the man, a volunteer on Sen. Bernie Sanders campaign in Iowa in 2016, who shot up a congressional baseball practice in June 2017, severely injuring several lawmakers, including Rep. Steve Scalise (R-La.).

​”We would also never blame Barack Obama for the police shootings in Dallas​,” he said.

The reference was to the gunman who ​ambushed and killed five police officers in Dallas in July 2016.

He told police before he was killed that he was angry about the shooting of black men by cops.

Some Republicans and conservatives blamed what they called former President Obama’s anti-police comments for inspiring the shooting.

​”Quite frankly, it’s ridiculous to make those connect in some way​,” Gidley said. “​​You have to blame the people here who pulled the trigger.”

​Trump, who’s planning on traveling to the border town of El Paso and Dayton Wednesday, has been criticized by some Democrats for fueling anger with his remarks about an “invasion” of migrants heading to the US.

The El Paso shooter posted a manifesto online moments before Saturday’s mayhem that echoed many of the same comments.

“Donald Trump is responsible for this. He is responsible because he is stoking fears and hatred and bigotry,” Sen. Cory Booker, a 2020 presidential hopeful, said on CNN’s “State of the Union” on Sunday.

Gidley said the president cleared his White House schedule on Tuesday to meet “with staff on a wide range of policies, having conversations in prepping for his trip to these communities.”

“This is a very, very serious moment in our country’s history. This president recognizes the gravity of this moment​,” he said.