US President Donald Trump has invoked a debunked myth about a general who fought Islamist militants by using pig's blood to commit mass executions.
The president's tweet came hours after a driver crashed a van into a crowd of people in Barcelona, leaving many dead or injured.
"Study what General Pershing... did to terrorists when caught," Mr Trump said, referring to the discredited story.
Historians and fact checkers say there is no truth to it.
The myth, which has circulated online, refers to General John Pershing's actions during the US war in the Philippines in the early 1900s.
He is said to have rounded up 50 terrorists and then ordered his men to shoot 49 of them, using bullets dipped in pig's blood. The survivor was told to go back and tell his people what happened.
Pigs are considered ritually unclean in Islam, and in his tweet the president said the general's actions acted as a deterrent to further acts of terror.
His comments came shortly after more than a dozen people were killed on Thursday in the Las Ramblas area of Barcelona.
Police say it was clearly a terrorist attack and they have arrested two people but not yet located the driver.
Study what General Pershing of the United States did to terrorists when caught. There was no more Radical Islamic Terror for 35 years!— Donald J. Trump (@realDonaldTrump) August 17, 2017
On the campaign trail, Mr Trump once told the same story, but that time he said there was no Islamist insurgency for 25 years, rather than 35.
The president has been engulfed in controversy since Saturday, when he said violence at a far-right rally should be blamed on "all sides".
Heather Heyer was killed when a speeding car rammed into a crowd of anti-fascist protesters in Charlottesville.
Republicans have rounded on President Trump for his comments and a slew of resignations among chief executives on two business councils led to their disbandment.
Trump said he likes to "know the facts" be4 making a statement— Oliver Darcy (@oliverdarcy) August 17, 2017
He responded to Barcelona by tweeting debunked rumor https://t.co/BWWFQQarYL