A man who Long Beach police hit with a baton, Tasered and pepper sprayed last year was freed from jail Friday after jurors cleared him of charges that he attacked a police officer with a bicycle and violently resisted arrest.

However, the panel did convict 31-year-old Solomon Brooks on two lesser counts of misdemeanor resisting officers during the June 3, 2016 traffic stop when police pulled him over for riding without a bicycle light.

If jurors had convicted Brooks on the felonies as originally charged, he would have faced life in prison because he has a criminal record that includes two strikes.

Instead, a Los Angeles County Superior Court judge immediately sentenced Brooks to a year in jail and authorities freed him within hours because he had already spent that much time behind bars awaiting trial.

“I’m ecstatic,” Brooks’ mother, Kathleen Brooks, said outside the fourth-floor Long Beach courtroom. “Every time I came up here, I thought I was taking him home. Now it’s really happening.”

Brooks and his attorney have insisted for months that he was the victim.

• RELATED: Violent arrest caught on video draws conflicting stories

They repeatedly pointed to cellphone video taken by a bystander that shows two officers chasing Brooks around a car. In the footage, which the jury watched repeatedly, Brooks appears to crouch down and raise an arm as an officer swings a baton at him.

A voice yells “Don’t Tase me,” or, “Don’t hit me.”

Although the two officers involved in the arrest described other times they hit, pepper sprayed and Tasered Brooks, neither included that specific interaction in their reports, Brooks’ attorney, Meghan Blanco, pointed out during the trial.

“Do you really believe that both of them forgot about this interaction?” Blanco asked jurors as the case concluded Thursday.

Before jurors began deliberating, Deputy District Attorney Drew Harbur implored them to look beyond the video, which he compared with other footage of officers using force that has made headlines across the country.

“The question I asked you to consider is whether this case is one of those cases, whether this case is one of those headlines,” he said.

Brooks, he argued, invited the confrontation by fleeing from police and then throwing his bike at an officer when he was finally pulled over.

“If the defendant just stops his bike, he gets a verbal warning. … At worst — maybe officers are in a bad mood that day — he gets a citation,” Harbur said.

But during Brooks’ four-day trial, witnesses gave clashing testimony about who started the violence.

• RELATED: Man risks life sentence trying to prove police attacked him

Police alleged Brooks repeatedly attacked them, but diners at a nearby restaurant and an employee at a burger shop said they never saw Brooks act aggressively while he fled.

At one point, Harbur told jurors it seemed like the defense’s key witness described a completely different event than the two arresting officers.

That witness — who was working at the burger shop a few feet from where the altercation started — said an officer attacked Brooks first by hitting him with a baton without warning while Brooks was still riding his bike.

The prosecution’s case relied mostly on testimony from the Long Beach police officers, Brady Vriens and Leticia Newton, who pulled Brooks over that evening.

Both testified Brooks flipped them off and continued pedaling away when they chirped their police cruiser’s siren and yelled at him to stop on Atlantic Avenue near Sixth Street.

They said Brooks eventually stopped about a block later just past the Louis Burger restaurant on Atlantic Avenue. That’s where Brooks got off his bike and threw it at Vriens, who’d jumped out of the car to chase him on foot, according to the officers.

“He said, ‘All right, all right, let’s do this,’ and he jumped off the bike,” Vriens said from the stand.

Vriens wasn’t hurt by the bike, which hit him in the leg, he testified.

Both officers said Brooks then raised his fists in an attempt to fight Vriens.

• VIDEO: Long Beach police arrest Solomon Brooks

However, there were some discrepancies between the two officers’ testimonies.

Vriens said Brooks threw a punch at him after running a few feet north to the front of the Louis Burger, but Newton said she never saw Brooks throw a punch of any kind.

The officers agreed that Brooks then led them on a short foot chase to the front of a Korean restaurant on the next block where they were able to wrestle him to the ground.

During the chase, the officers said they Tasered, pepper sprayed and used a baton on Brooks multiple times.

“He would run, stop, turn, face us and confront us, and when the force was used, he’d run again,” Vriens said.

Each time Brooks faced them, he raised his fists as if to fight, according to the officers.

Two people dining at the Korean restaurant where the altercation ended testified they watched Brooks fleeing but never saw him raise his fists.

Although Blanco challenged the officers’ credibility using the video, the footage also cast doubt on the defense’s key witness.

Elizabeth Brainard, the burger shop employee who said police instigated the violence, testified that she witnessed firsthand what happened in the video. But the dark, grainy clip wasn’t recorded in front of the restaurant where she worked. It was filmed about a block away across Sixth Street in front of the Korean restaurant, according to testimony.

Harbur, the prosecutor, pointed out that Brainard didn’t come forward when police asked her if she’d seen the incident. Brainard said she only chose to testify after Brooks’ mother found her and asked her to make a statement about what happened.

“I also know what I saw was wrong, and for that, I want to speak up,” Brainard said in a hushed tone from the witness stand.

Brooks’ religious and political beliefs also became a central issue in the trial.

• RELATED: Man accused of assault on officers referred to himself as a ‘tribal sovereign’

“The defendant doesn’t believe that courts in the United States have authority over him,” Harbur said in his closing argument.

During the trial, Harbur read jurors portions of a letter Brooks sent a judge after his arrest. Brooks wrote that he’s part of the United Native American Moorish Society and not subject to the court’s jurisdiction. Brooks refers to himself in the letter as a “tribal sovereign.”

Harbur argued Brooks has shown contempt for the law in the past. About eight months before his arrest in Long Beach, he caused a commotion when officers in Hollywood tried to talk with him, Harbur said.

In that case, Brooks backed away from officers into the street where he stood and refused to surrender until officers grabbed him from behind and Tasered him, an LAPD officer testified at trial.

“You have the right to be a nonconformist in the country, but that doesn’t make you special, and that doesn’t mean you get to write your own laws,” Harbur told jurors.

Outside the courtroom, Brooks’ mother said he responded that way to draw attention because he feared one of the officers would shoot him.

Brooks risked spending the rest of his life behind bars just to take his case to trial.

In May, he turned down an offer from prosecutors that would’ve freed him from jail immediately if he pleaded to one count of resisting arrest.

He decided to face a trial knowing a pair of convictions in 2007 for attempted robbery and battery with a deadly weapon meant he was facing his third strike if convicted.

Friday, a relieved Kathleen Brooks said her son can now get back to his life.

“They stole it from him for about a year,” she said.