The man who shot dead five police officers in Dallas and wounded seven more was planning an even larger attack, the city's police chief says.

Micah Johnson, 25, was angry with the recent killings of black men by police and wanted to kill white officers, police say.

Police chief David Brown said he was "convinced" Johnson had wider plans.

He told CNN that Johnson, a military veteran, appeared to have practised detonating explosives.

Mr Brown also said police were trying to find the significance of the letters "RB" that Johnson had written in his own blood, near where he was killed by a remote detonation by police.

Officers were also reading a journal found in Johnson's house that Mr Brown said was proving "hard to decipher".

Mr Brown also revealed that during two hours of negotiations last Thursday, the attacker taunted police.

"He just basically lied to us – playing games, laughing at us, singing, asking how many [police officers] did he get and that he wanted to kill some more and that there were bombs there."

"So there was no progress on the negotiation… I began to feel that it was only at a split second he would charge us and take out many more before we could kill him," Mr Brown added.

Johnson launched his attack in Dallas as a protest was taking place against the deaths of black men at the hands of police.

The deaths of Philando Castile in St Paul, Minnesota, and Alton Sterling in Baton Rouge, Louisiana, last week led to more protests across US cities on Saturday.

Hundreds of people were arrested in the demonstrations nationwide. While most passed peacefully, fireworks, bottles and rocks were thrown at police in St Paul in clashes along a main interstate highway.

Close to 100 people were arrested there as 21 police officers were injured.

In Baton Rouge, several hundred protesters gathered outside the police department shouting "No justice! No peace!" and also at the convenience store where Alton Sterling was shot.

There was also tension as armed members of the New Black Panther Party stood face to face with officers in riot gear. Louisiana law allows weapons to be carried openly.

Among the 100 people held was DeRay Mckesson, who has become a national voice for the Black Lives Matter movement, and three journalists.

Mr Mckesson was freed on bond on Sunday.

In contrast to protesters in other parts of the country, the people of Dallas are uniting behind their police officers.

A makeshift shrine in memory of the five officers gunned down on Thursday night sprang up outside police headquarters in the Cedars district of the city within hours of the attack, and it is now a mass of flowers, balloons, stuffed toys and messages of sympathy.

Throughout the day, a constant stream of visitors have come here – black, white, Hispanic; young couples, elderly folk, little girls in sun dresses – to pay their respects, say a prayer or simply shed a tear.

An impromptu prayer session on the steps of police headquarters ended with hugs and a police officer breaking down in tears.

Earlier, a mother was overheard telling her son it was up to his generation to make things better: "This generation tried, but soon it will be up to you," she said.

"The police in Baton Rouge have been truly awful tonight," Mr Mckesson said in a livestreamed Periscope video on Saturday night.

"They have provoked people. They chase people just for kicks. The police have been violent tonight. The protesters have not.''

Other protests took place in Nashville, Indianapolis and Washington DC.

Demonstrations have continued despite an effort by President Barack Obama to soothe the tension.

On a visit to Spain on Sunday, he demanded an end to anti-police violence.

"Whenever those of us who are concerned about fairness in the criminal justice system attack police officers, you are doing a disservice to the cause," he said.

Also on Sunday, the White House said Mr Obama would travel to Dallas on Tuesday. He will speak at an interfaith memorial service.