Two National Guard soldiers are critically injured after being gunned down in Washington DC, less than two blocks from the White House, in what the city's mayor called a "targeted shooting".

The city's police said a lone suspect opened fire on the National Guard members on Wednesday afternoon, before being subdued by other National Guard nearby who had heard the gunfire.

The attack prompted the White House to briefly go into lockdown and a temporary flight stoppage at the city's main airport on the eve of Thanksgiving.

President Donald Trump, who was in Florida at the time of the attack, vowed that the attacker would "pay a very steep price". The suspect's motive and identity are unclear.

Trump, a Republican, has sent the National Guard to Democratic-led US cities, including Los Angeles, Chicago and Memphis, arguing the deployments were needed to tackle crime. The moves have provoked lawsuits accusing the White House of overreach.