A gunman killed three black people in a racially motivated attack then killed himself in Jacksonville, Florida, the city's sheriff said.
The man, described as white and in his early 20s, entered a Dollar General store and opened fire, triggering a standoff with police.
Sheriff T K Waters said two men and a woman were killed by the gunman, who wore body armour and left manifestos.
Mayor Donna Deegan said it was a "hate-filled crime" driven by racist hatred.
The sheriff said the shooter - who has not yet been officially named - carried a lightweight semi-automatic rifle and a handgun.
He is believed to have acted alone and allegedly wanted to kill himself. He lived in Jacksonville's Clay County with his parents and left several messages about his intentions, Sheriff Waters said, including one to his parents and another to the media. The sheriff added that at least one of the guns had a swastika drawn on it.
The FBI has opened a civil rights investigation into the shooting, which it is treating as a hate crime.
The attack happened less than a mile from the historically black Edwards Waters University.
The shooter first went to the university campus, where he was asked to identify himself by a security officer, the university said in a statement. When he refused, he was asked to leave.
"The individual returned to their car and left campus without incident," the statement added.
Sheriff Waters said the gunman was then seen putting on a bullet-resistant vest and a mask before leaving the campus.
The university went into lockdown after the shooting.
Jacksonville Mayor Donna Deegan told local TV channel WJXT: "One shooting is too much but these mass shootings are really hard to take."
Florida Governor Ron DeSantis called the gunman a "scumbag" and described the shooting as "horrific".
"He [the gunman] was targeting people based on their race, that is totally unacceptable," said Mr DeSantis, who is competing to be the Republican party's presidential candidate.
"This guy killed himself rather than face the music and accept responsibility for his actions and so he took the coward's way out."
The White House said President Joe Biden had been briefed on the shooting.
In a statement provided to the BBC's US partner, CBS News, Dollar General said it was "heartbroken by the senseless act of violence that occurred at our Kings Road store", adding that "supporting our Jacksonville employees and the DG family impacted by this tragedy is a top priority as we work closely with law enforcement".
There have been over 28,000 gun deaths in the US so far this year, according to the Gun Violence Archive website.
The Jacksonville attack comes on the 60th anniversary of the March on Washington and Martin Luther King Jr's famous "I have a dream" speech. Tens of thousands of people gathered in the capital on Saturday to mark the historic milestone in the civil rights movement.