US President Donald Trump has reacted to the Barcelona terror attack by repeating a war myth about a US general more than 100 years ago dipping bullets in pig's blood to fight Muslim insurgents.

World leaders expressed sympathy after the Spanish city was rocked by a terror attack on Thursday (17 August) when a rented van mowed down dozens on Las Ramblas in the centre of the city.

Trump joined them in condemning the attack, initially saying the US will "do whatever is necessary to help" and told Spaniards to "be tough and strong".

But in a follow-up tweet, the bombastic billionaire made a reference to an old war myth about Gen John Pershing who was governor of Moro province in the Philippines, between 1909 and 1913.

The tweet urged followers to: "Study what General Pershing of the United States did to terrorists when caught. There was no more Radical Islamic Terror for 35 years!"

This tweet follows a similar claim Trump made at an election rally in South Carolina in February 2016 where he discussed "getting tough" on Islamic extremism and spoke of the insurgency in The Philippines.

Barcelona terror attack
Medical staff members and policemen stand in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona on August 17, 2017 Getty

"They were having terrorism problems just like we do," Trump said according to Mother Jones. "And he caught 50 terrorists who did tremendous damage and killed many people.

"And he took the 50 terrorists, and he took 50 men, and he dipped 50 bullets in pig's blood."

He claimed Pershing then "had his men load his rifles and he lined up the 50 people, and they shot 49 of those people. And the 50th person, he said, 'You go back to your people and you tell them what happened.'"

He added: "And for 25 years there wasn't a problem" although he seems to have revised that figure up to 35 years.

After the original claims, Time magazine spoke to two historians who found no evidence to support the claim with Snopes, a myth-busting site, coming to the same conclusion.

However, the Time investigation references the History News Network which discovered a Chicago Daily Tribune article from 1927 describes Pershing sprinkling prisoners with pig's blood, then setting them free.

Also, Shannon Dunn, assistant professor of religious studies at Gonzaga University, told HuffPost the idea that Muslims believed they would go to hell if shot with pigs' blood, the reason behind the supposed tactic, was false.

Other leaders however lent their support and solidarity to Spain. Spanish Prime Minister Mariano Rajoy said "will never defeat a United people who love freedom from barbarism" and added he was travelling to Barcelona to coordinate security efforts.

Donald Trump at a West Virginia rally
US President Donald Trump speaks during a Make America Great Again Rally at Big Sandy Superstore Arena in Huntington, West Virginia, August 3, 2017 Getty

"Maximum coordination to arrest the attackers, reinforce security and attend to all those affected," he said.

UK Prime Minister Theresa May said in a statement that she was "sickened by the senseless loss of life in Barcelona" and that the Foreign Office was trying to establish if any British nationals were injured in the attack.

French president Emmanuel Macron also expressed his condolences with Spain and said both countries were "united and determined" after the "tragic attack".