A man who drove into a Walmart warehouse in California and went on a shooting rampage that left him and another man dead, and four others wounded, was fired from his job at the centre last year, authorities said.

Louis Wesley Lane, 31, was let go from the distribution centre near Red Bluff in February 2019 after failing to show up for work, Tehama County Assistant Sheriff Phil Johnston told a news conference early on Sunday.

The violence started on Saturday afternoon when a man with a semi-automatic rifle circled the car park four times before crashing into the building and opening fire.

After the shooting, Lane engaged with Red Bluff police officers in the car park, where they exchanged 20 to 30 rounds, Mr Johnston said. He was shot by police and pronounced dead in hospital.

The employee who died was Martin Haro-Lozano, 45, of Orland, California. He was taken to hospital by a sheriff’s deputy due to the extent of his injuries, but later died, Mr Johnston said.

Distribution Center Shooting
Lieutenant Yvette Borden and Assistant Sheriff Phil Johnston, of the Tehama County Sheriff’s Office, at the scene (Mike Chapman/The Record Searchlight/AP)

Those shot were taken to St Elizabeth Community Hospital and their injuries were not life-threatening, Mr Johnston said.

Another victim was struck by the gunman’s car as he drove into the building and was being treated in hospital, he said.

Investigators have not determined a motive in the shooting, other than his prior employment at the centre, Mr Johnston said.

Some of the 200 workers inside the facility locked themselves in a room , employees told KHSL-TV.

Scott Thammakhanty, an employee at the facility’s receiving centre, told the Redding Record-Searchlight that he heard the gunman open fire.

“It went on and on — I don’t even know how many times he fired,” Mr Thammakhanty said. “I just know it was a lot.”

Mr Thammakhanty and others started running for their lives, and he saw people lying on the ground as he ran, he said.

Fellow employee Franklin Lister told The New York Times he had just started work when a co-worker ran down the hallway shouting: “Active gunfire! Active shooter!”