A man wanted over the fatal shooting of a security guard set out to kill as many white people as he could, gunning down three men on the streets of Fresno, California, before being captured, authorities have said.
Kori Ali Muhammad, 39, was arrested shortly after the Tuesday morning rampage that left three white men dead.
Muhammad, who is black, fired 16 rounds in less than two minutes at four places within a block, shooting men who simply appeared to be going about their daily business, police said.
During his arrest, Muhammad shouted "Allahu Akbar" - God is great - but Fresno police chief Jerry Dyer said the shootings had "nothing to do with terrorism in spite of the statement he made".
"This is solely based on race," he said.
Muhammad first walked up to a lorry and shot a Pacific Gas & Electric employee sitting in the passenger seat.
The driver, who is Latino, sped off to the police station for help, but the shot worker, a 34-year-old white man, died.
Muhammad then shot at another person and missed, police said. He aimed at a third, killing the 37-year-old on the pavement as he walked with a bag of groceries in a neighbourhood lined with tall trees.
The final victim, 58, was shot dead in the car park of a charity building.
Mr Dyer said Muhammad approached a vehicle in between the shootings, but he spared the lives of two women who were in the car with a child. The women were Latinas, he said.
"These individuals who were chosen today did not do anything to deserve what they got," Mr Dyer said.
"These were unprovoked attacks by an individual that was intent on carrying out homicides today. He did that."
Police had put out a news release hours before the shootings Tuesday, saying that Muhammad was armed and dangerous and wanted over the shooting death of a security guard at a Motel 6 last week. The guard, 25-year-old Carl Williams, was white.
Muhammad told officers who arrested him that he was the man they were looking for, Mr Dyer said, saying: "I did it. I shot them."
Police are searching for the revolver Muhammad said he threw into a pile of clothing.
Muhammad faces four counts of murder and at least two additional charges of assault with a deadly weapon.
Stephen Hughes, 66, said he and his wife rushed home after receiving a frantic call from a neighbour.
Mr Hughes came home to see a body draped in a blanket on the pavement leading to his front door.
He first thought the shooting was gang-related, but then noticed the bag of groceries.
"It looks like a guy carrying his groceries home from the store," Mr Hughes said.
On what appeared to be Muhammad's Facebook page, he repeatedly posted "#LetBlackPeopleGo" and encouraged "black warriors" to "mount up". A flurry of posts emerged in the past day.
He wrote that his "kill rate increases tremendously on the other side" and also posted about "white devils".
On several occasions, he wrote updates that included the phrase "Allahu Akbar".
Muhammad has a criminal history that includes arrests on weapons, drugs and false imprisonment charges and making terrorist threats.
He had been associated with gangs but he was not a confirmed member, police say.
Muhammad was charged in 2005 with possessing cocaine with intent to distribute, court records show.
Federal prosecutors said at the time that he was also in possession of a 9mm semi-automatic handgun and two rifles after being convicted of a felony.
He claimed insanity and his lawyer requested a psychiatric examination, saying Muhammad "appeared eccentric with some bizarre beliefs".
A psychiatrist who examined Muhammad believed he had psychosis, his lawyer said in the court filing.
He also "suffered auditory hallucinations and had at least two prior mental health hospitalisations", according to court documents.
His lawyer said Muhammad had "paranoia" and thought the justice system and his defence were conspiring against him, court papers said.
Public records list Muhammad as Cory Taylor and other aliases with addresses in Fresno and Sacramento.
Police said his former name was Cory McDonald and a woman who identified herself as Taylor's grandmother said the family last saw him on Easter Sunday.
Police say two of the victims may have been clients of Catholic Charities, which provides a variety of services for refugees, the homeless and those with disabilities.