President Trump condemned the attacks in Barcelona, but not before he stoked the simmering controversy over his Charlottesville comments by lamenting the removal of Confederate statues — all amid doubts from his own party about his moral rectitude and his psychological stability.

“I’m not going to defend the indefensible,” U.S. Sen. Tim Scott of South Carolina told HBO’s Vice News.

“I’m not here to do that. I’m here to be clear and to be concise and succinct. His comments on Monday were strong. His comments on Tuesday started erasing the comments that were strong. What we want to see from our president is clarity and moral authority and that moral authority is compromised when Tuesday happens. There’s no question about that. We should all call that on the carpet,” Scott said.

Republican U.S. Sen. Bob Corker of Tennessee, who at one time was on Trump’s short list for vice president, took the unusual step of questioning the Manhattan billionaire’s competence to serve in the Oval Office.

“The president has not yet been able to demonstrate the stability, nor some of the competence, that he needs to demonstrate in order to be successful,” Corker said.

“I don’t think that the president has appropriately spoken to the nation on this issue. And I think that sometimes he gets into a situation where he doubles down in order to … make a wrong a right. I think he’s done that in this case.”

Corker added that Trump “recently has not demonstrated that he understands the character of this nation.”

While the horrific images from Barcelona unfolded on TV screens and cellphones, Trump at first condemned the attack on Twitter and promised to “do whatever is necessary to help.”

But then he generated more controversy in a subsequent tweet that Americans should “study what General Pershing of the United States did to terrorists when caught. There was no more Radical Islamic Terror for 35 years!”

Trump was recycling an anecdote he told on the campaign trail that Army Gen. John Pershing, while in the Philippines, lined up 50 terrorists, dipped 50 bullets in pig’s blood, shot 49 of them, and told the 50th to go and tell the others what he had done.

Historians say there’s no evidence that ever happened and PolitiFact rates it a “pants on fire” lie.

Criticism has intensified since Tuesday’s presser when he blamed “both sides” for the deadly violence at the white supremacist rally in Charlottesville, Va.

But yesterday, instead of changing the subject to his tax overhaul or infrastructure proposals — or to the resurgence of terrorism — he questioned the removal of statues of Robert E. Lee and Stonewall Jackson, warning that the next targets could be Founding Fathers George Washington and Thomas Jefferson, both slave owners.

“Sad to see the history and culture of our great country being ripped apart with the removal of our beautiful statues and monuments,” he tweeted.

“You can’t change history, but you can learn from it. Robert E Lee, Stonewall Jackson — who’s next, Washington, Jefferson? So foolish! Also the beauty that is being taken out of our cities, towns and parks will be greatly missed and never able to be comparably replaced!”

Yet there’s plenty of evidence that the public supports the president’s take on the statues. Some 62 percent believe Confederate statues should remain as historical symbols, according to a PBS/NPR/Marist poll. In contrast, just 27 percent believe they should be removed because they’re offensive.