A 39-year-old man went on a shooting spree in the central California city of Fresno on Tuesday, killing three people and injuring another before being arrested, authorities said.
Fresno police chief Jerry Dyer told reporters that the suspect, an African-American named Kori Ali Muhammad, shouted "Allahu Akbar" - "God is great" in Arabic - as he was being taken into custody.
But he said it did not appear the killings were an act of terrorism and a probe was under way to determine if they qualified as a hate crime.
He said Muhammad, who used the alias "Black Jesus" and was wanted in the killing last week of an unarmed security guard outside a motel in the city, had indicated in postings on his Facebook page that he hated white people and the government.
"This was a random act of violence," Dyer said. "These were unprovoked attacks by an individual who was intent on carrying out homicides today."
He said all the victims were white males and there was every reason to believe Muhammad had acted alone.
Lieutenant Mark Hudson, a police spokesman, told AFP the FBI had been contacted about the killings.
A spokeswoman for the FBI declined comment, referring media inquiries to local police.
Dyer said Tuesday's shooting spree began downtown at around 10:45 am local time when one man sitting in a truck was shot through the passenger window.
The other victims were shot nearby during a rampage that lasted about a minute and during which up to 16 rounds were fired.
Dyer said Muhammad surrendered to police at the scene, telling officers "you guys are looking for me."
Dyer said Muhammad had a criminal history including for weapons violations, drugs and making terrorist threats.
He said he was known to be homeless at times, and had associated with gangs.
Muhammad's father, Vincent Taylor, told The Los Angeles Times that his son was convinced he was part of an ongoing war between whites and blacks, and that "a battle was about to take place."
Muhammad faces four counts of murder and two counts of attempted murder, authorities said.
Hudson said the weapon used in the killings had not been recovered.
The rampage is likely to reignite a long-running debate in the US on gun control, an issue that has dogged successive administrations.
More than 30,000 people are killed by gun violence in the United States every year, half of them between the ages of 18 and 35, according to statistics.
So far this year, there have been more than 17,700 incidents involving guns nationwide and 4,405 fatalities, Gun Violence Archive, a not-for-profit group, said on its website.
It said the victims include at least 184 children up to 11 years old and 914 teenagers between the ages of 12 and 17.
President Donald Trump has yet to spell out his policy on gun control. With Republicans in control of the White House and Congress, some critics fear his administration will ease restrictions.