​WASHINGTON — Mayor Pete Buttigieg on Sunday compared guns to a “false God” as he called out the gun lobby in the wake of back-to-back mass shootings in El Paso, Texas, and Dayton, Ohio.

“Here’s something to think about this Sunday morning, is a gun a tool or is it an idol?” Buttigieg​, who served in Afghanistan as a member of the Navy reserve,​ mused on CNN’s “State of the Union.”

“Anytime I’ve carried or handled a weapon … I’ve viewed it as a tool, but if the gun corporation lobby, which is what the NRA is, now has people viewing guns as a thing to be loved, a thing to be protected, a thing that is the source of our freedom and power and a thing to which we are willing to sacrifice human life, isn’t that the definition of a false God?” Buttigieg asked.

In an interview on “Fox News Sunday,” the mayor​ of South Bend, Ind.,​ added, “We cannot allow the Second Amendment to be a death sentence for thousands of Americans a year. Nor can we say there’s nothing that can be done when we live in the only country where this is routine.”

On Saturday Buttigieg had reacted to the first of the two shootings — at an ​Walmart in ​El Paso​ — by saying that “America is under attack from homegrown white nationalist terrorism.”

The Texas massacre is being investigated as domestic terrorism and a possible hate crime as an online user, suspected of being the shooter, posted a 2,300 racist “manifesto” and diatribe against Hispanic immigrants to a message board 20 minutes before the slaughter began.

“Well, this is terrorism and we have to name it as such. It’s very clear that the loss of American life: In Charleston, in San Diego, in Pittsburgh and by all appearances now in El Paso​,​ too, is symptomatic of white nationalist terrorism,” Buttigieg told Fox’s Chris Wallace on Sunday.

“We cannot keep America safe from this threat to the American people if we cannot name it or confront it.”

Buttigieg, a 2020 White House hopeful, then pointed a finger at the president.

“Well, there’s no question that white nationalism is condoned at the highest levels of our government,” the 37-year-old mayor said.

“There is a measure of responsibility that you just can’t get away from when you have case after case of racial rhetoric coming out of the White House,” Buttigieg added.

He noted how the Republican Party ran away from David Duke when the former KKK leader ran for office in Louisiana.

Buttigieg compared that to Trump’s ​”some very fine people on both sides” remark ​following the white nationalist march in Charlottesville, V​a., in 2017​,​​ that resulted in the death of one counter-protester.

“Of course​,​ this is part of a climate when people in this grip of this hateful extremist ideology feel validated and they feel validated from all the way at the top and that is part of our problem,” Buttigieg said.