ST. LOUIS — A white former police officer was acquitted Friday in the 2011 death of a black man who was fatally shot following a high-speed chase, and hundreds of demonstrators streamed into the streets of downtown St. Louis and later an upscale neighborhood to protest the verdict that had stirred fears of civil unrest for weeks.

Ahead of the acquittal, activists had threatened civil disobedience if Jason Stockley were not convicted, including possible efforts to shut down highways. Barricades went up last month around police headquarters, the courthouse where the trial was held and other potential protest sites. Protesters were marching within hours of the decision.

More than a dozen arrests were made, and several officers were hurt as the day went on.

The case played out not far from the suburb of Ferguson, Missouri, which was the scene of the fatal shooting of Michael Brown, the unarmed black 18-year-old who was killed by a white police officer in 2014. That officer was never charged and eventually resigned.

Stockley, who was charged with first-degree murder, insisted he saw 24-year-old Anthony Lamar Smith holding a gun and felt he was in imminent danger. Prosecutors said the officer planted a gun in Smith’s car after the shooting.

In an interview with the St. Louis Post-Dispatch, Stockley said he understands how the video of him fatally shooting Smith looks bad to investigators and the public, but he said the optics have to be separated from the facts and he did nothing wrong.

“I can feel for and I understand what the family is going through, and I know everyone wants someone to blame, but I’m just not the guy,” he said.

Stockley, 36, asked the case to be decided by a judge instead of a jury. Prosecutors objected to his request for a bench trial.

“This court, in conscience, cannot say that the State has proven every element of murder beyond a reasonable doubt or that the State has proven beyond a reasonable doubt that the defendant did not act in self-defense,” St. Louis Circuit Judge Timothy Wilson wrote in the decision.

In a written statement, St. Louis Circuit Attorney Kim Gardner acknowledged the difficulty of winning police shooting cases but said prosecutors believe they “offered sufficient evidence that proved beyond a reasonable doubt” that Stockley intended to kill Smith.

Assistant Circuit Attorney Robert Steele emphasized during the trial that police dashcam video of the chase captured Stockley saying he was “going to kill this (expletive), don’t you know it.”

Less than a minute later, the officer shot Smith five times. Stockley’s lawyer dismissed the comment as “human emotions” uttered during a dangerous police pursuit. The judge wrote that the statement “can be ambiguous depending on the context.”

Stockley, who left St. Louis’ police force in 2013 and moved to Houston, could have been sentenced to up to life in prison without parole.

The case was among several in recent years in which a white officer killed a black suspect. Officers were acquitted in recent police shooting trials in Minnesota, Oklahoma and Wisconsin. A case in Ohio twice ended with hung juries, and prosecutors have decided not to seek a third trial.

“It’s a sad day in St. Louis, and it’s a sad day to be an American,” the Rev. Clinton Stancil, a protest leader, said regarding the acquittal.

The crowd of protesters included blacks, whites and other races. Some people carried guns, which state law allows.

Efforts at civil disobedience were largely unsuccessful. When several demonstrators tried to rush onto Interstate 64, they were blocked on an entrance ramp by police cars and officers on bikes. When they tried to enter the city’s convention center, the doors were locked.

At times, things escalated. Earlier in the day, protesters stood in front of a bus filled with officers in riot gear, blocking it from moving forward. When officers began pushing back the crowd, protesters resisted and police responded with pepper spray. Later, protesters surrounded a police vehicle and damaged it with rocks. Some in the crowd threw rocks and pieces of curbing at police who tried to secure the vehicle. That led to officers using pepper spray again.

As night came, hundreds of protesters moved to St. Louis’ upscale Central West End section, where they marched and chanted as people looked on from restaurants and hospital windows lining busy Kingshighway. The group tried marching onto I-64 again, but police blocked their path.

Following a mostly silent sit-in, protesters resumed marching. Some demonstrators burned an American flag as others cheered.

After protesters broke a front window and splattered red paint at St. Louis Mayor Lyda Krewson’s home, police in bulletproof vests and helmets arrived and demanded they get off the lawn and out of the street in front of the house. Officers used tear gas to try to move the crowd out of the area.

Krewson had called for calm and understanding ahead of the verdict and later said she was appalled by what happened to Smith and “sobered” by the outcome.

Some journalists covering the protests said they were targets of threats and violence from demonstrators. A freelance Associated Press videographer said a protester threw his camera to the ground and damaged it. He said later he was using a different camera and protesters told him they would beat him if he didn’t put it away. A KTVI reporter said water bottles were thrown at him after a protester taunted him, drawing a crowd.

The St. Louis area has a history of unrest in similar cases, including after Brown’s death, when protests, some of them violent, erupted.

In Smith’s case, the encounter began when Stockley and his partner tried to corner Smith in a fast-food restaurant parking lot after seeing what appeared to be a drug deal. Stockley testified that he saw what he believed was a gun, and his partner yelled “gun!” as Smith backed into the police SUV twice to get away.

Stockley’s attorney, Neil Bruntrager, argued that Smith tried to run over the two officers. Stockley fired seven shots as Smith sped away. A chase ensued.

At the end of the chase, Stockley opened fire only when Smith, still in his car, refused commands to put up his hands and reached along the seat “in the area where the gun was,” Bruntrager said. Stockley said he climbed into Smith’s car and found a revolver between the center console and passenger seat.

But prosecutors questioned why Stockley dug into a bag in the back seat of the police SUV before returning to Smith’s car.

The gun found in Smith’s car did not have his DNA on it, but it did have Stockley’s.