A man accused of killing four people told detectives in a recording that he was fed up with racism and that he might as well keep killing as many white men as he could.

Kori Ali Muhammad, a black man who is currently on trial for a shooting spree that took place in California in 2017, could face the death penalty if convicted, Fresno Bee and ABC30 (KFSN-TV) reported.

In a recording shown during the trial, taken by detectives on the day of his arrest, Mr Muhammad told police: “I didn’t want to do nothing to law enforcement so I just found some white men to kill.”

A security camera recorded Muhammad coming up behind 25-year-old motel security guard Carl Williams and shooting him.

Mr Muhammad told officers that while trying to visit a friend in the motel Mr Williams was disrespectful to him.

“It starts taking its toll on you and you get fed up with the racism,” he said. “You get tired of letting things slide."

Earlier testimony alleged that Mr Williams noticed Mr Muhammad and told the motel manager, who asked Mr Muhammad to register and pay a nominal visitor’s fee.

Mr Muhammad went to the office to register, but the manager testified he felt threatened and kicked out the guest and Mr Muhammad.

The alleged killer said that if he was “going down for murder” he might as well “kill as many white men” as he could.

Days after Mr Williams was murdered a gunman shot and killed three other people at random in the downtown area. A 34-year-old, 37-year-old and a 58-year-old man were all shot within a small timeframe.

The first victim was Zachary Randalls, 34, who was sitting in the passenger seat of a Pacific Gas & Electric lorry.

“When I walked up to the truck, I saw a Mexican driver and a white guy,” Mr Muhammad said on the recording. “I didn’t want to target the driver because he was Mexican so I shot the white dude.”

Reports from 2017 claimed that Mr Muhammad shouted “Allahu Akbar” (“God is Great”) during his arrest.

Mark Gassett, 37, and David Jackson, 58, were identified as the other two victims of the shooting.

At the time of the arrest Fresno police chief Jerry Dyer said the massacre had “nothing to do with terrorism in spite of the statement he made”.

“This is solely based on race,” he added.

At the time it was reported that on a Facebook page that appeared to be Mr Muhammad’s a user posted “#LetBlackPeopleGo” and encouraged “black warriors” to “mount up”.

Mr Muhammad’s defence claims that he is mentally ill.