A homicide suspect died in a shootout with police Wednesday in the middle of a San Francisco Bay Area freeway as stunned motorists looked on, some recording the scene on their cellphones and sharing it on social media.

Traffic came to a standstill for hours on the busy Interstate 80 that connects San Francisco with several other cities during the standoff between police and the unidentified man who had been chased about 40 miles (65 kilometers) by police.

The morning rush-hour standoff shut down all lanes of I-80 in the suburb of Emeryville. It ended when the suspect got out of a black sports utility vehicle and “officers received gun fire from the suspect,” authorities said. Officers fired back at the man, who was wounded and died of his injuries at a hospital.

The events unfolded after police in the city of Fairfield tried to detain the man, who they said was wanted in a homicide. Police did not identify him or provide details about the homicide.

When the driver refused to stop, Fairfield police chased the vehicle, officials said. Assisting them were officers from the city of Richmond and the California Highway Patrol.

Highway patrol officers used a spike mat to pierce the SUV’s tires and the standoff began with the vehicle stopped in Emeryville, surrounded by a dozen police cruisers.

“Officers negotiated with the suspect for an extended period of time until officers received gun fire from the suspect,” said a statement issued by the Emeryville, Fairfield and Richmond police departments. “Officers on scene returned fire and the suspect was struck during the exchange.”

The statement did not specify how many shots were fired or what type of weapons were involved.

A Facebook Live video shot from the air showed the man getting out of the car and taking a step before falling to the ground. Another video shot by a motorist appeared to show officers firing their guns and the sound of at least 20 gunshots.

Traffic was shut down during the standoff for miles (kilometers) on several key roads into San Francisco and surrounding cities.

California Highway Patrol Officer Matthew Hamer said the danger to motorists ended about 10:30 a.m.

The freeway’s eastbound lanes were reopened but the westbound section of the freeway remained closed Wednesday afternoon. Officials said they did not know how long it would be closed.