Barack Obama has pledged that the US will stand by its Gulf allies amid increasing tensions with Iran.