Trump Obama
Donald Trump and Barack Obama have sent condolences to the UK. Reuters

Former US president Barack Obama has shared his response to the terror attack in Westminster, sending condolences to the victims and their families.

The message sent by Obama differs from that shared by US President Donald Trump, who put his emphasis on the UK prime minister following the incident.

Taking to Twitter a day after the attack, Obama wrote: "My heart goes out to the victims and their families in London.

"No act of terror can shake the strength and resilience of our British ally."

Meanwhile, President Trump, who also shared his message on social media, wrote: "Spoke to UK Prime Minister Theresa May today to offer condolences on the terrorist attack in London. She is strong and doing very well."

In a later tweet, the president added: "A great American, Kurt Cochran, was killed in the London terror attack. My prayers and condolences are with his family and friends."

Trump's response was certainly more low key than it has been following previous terror attacks, when he has taken the opportunity to reiterate key policies or highlight his views on how to deal with terrorist groups.

His response is sure to be viewed by many as taking a more presidential tone than he has done in the past, possibly demonstrating the kind of restraint shown during his first joint session address to Congress - which many viewed as a turning point for Trump following a tumultuous first month in office.

However, Trump's son Donald Jr. faced a backlash after slamming London mayor Sadiq Khan just hours after the attack took place.

The president's son wrote on Twitter: ""You have to be kidding me?!: Terror attacks are part of living in big city, says London Mayor Sadiq Khan," sharing a link to an article written in September 2016.

Khan had commented following a bombing in New York that terror attacks were "part and parcel of living in a big city", explaining people should "be prepared for these sorts of things."

Donald Jr's comments were widely criticised, with some claiming he had used the attack to push his own political message.