Media playback is unsupported on your device Media caption US President Barack Obama: "We are heartbroken by the loss of life"

President Barack Obama has toured the flood-ravaged areas of Baton Rouge, Louisiana, where he vowed to help residents rebuild in the coming months.

"We are heartbroken by the loss of life," he said after his tour.

Mr Obama dismissed criticism that he arrived too late and praised state officials for their initial response.

The president also met the family of Alton Sterling and the families of the Baton Rouge police officers killed last month.

Mr Sterling, a black man, was killed at the hands of a white police officer in Baton Rouge.

His death, along with the police killing of Philando Castile in Falcon Heights, Minnesota, stoked racial tensions and led to protests across the country.

Nearly two weeks later, three officers were shot and killed and three more were injured in a shooting near the Baton Rouge police headquarters. The gunman, Gavin Long, was shot dead at the scene.

Republican presidential nominee Donald Trump, who travelled to Louisiana four days ago, and others have criticised Mr Obama for not cutting short his vacation on Martha's Vineyard to visit the devastated areas.

But Mr Obama hit back after meeting with flood survivors, urging Americans to stay focused on helping the state.

"Let me just remind folks. Sometimes once the flood waters pass, people's attention spans pass. This is not a one-off. This is not a photo-op issue," he said.

Mr Trump fired back on Tuesday, tweeting: "President Obama should have gone to Louisiana days ago, instead of golfing. Too little, too late!"

Image copyright AP Image caption President Barack Obama talks with a local resident while touring Castle Place, a flood-damaged area of Baton Rouge, Louisiana.

The deadly floods, which began on 11 August, have killed at least 13 people and have left more than 2,800 people in shelters.

The president declared a major disaster on 14 August, allowing the state to access federal resources to assist local officials with the clean-up.

The Federal Emergency Management Agency (FEMA) has already dispensed $127m (£96m) in assistance, according to the president.

"Sometimes when these kinds of things happen, it can seem like too much to bear," Mr Obama added.

"But what I want the people of Louisiana to know is you're not alone, even after the TV cameras leave."

The floods have been described as the worst natural disaster to hit the US since Hurricane Sandy in 2012.