Allen Scarsella took the stand Monday to describe shooting into a group of protesters as the only way he could protect himself, but a prosecutor worked to paint him as a racist looking for a reason to use his gun on black people.

Scarsella acknowledged that he shot five protesters on Nov. 23, 2015, after he and three others went to Minneapolis Police's Fourth Precinct to livestream an ongoing protest after the death of Jamar Clark, who was shot and killed during a scuffle with police.

Scarsella was charged with first-degree assault and riot, both felonies.

"I was really scared, the situation got totally out of control," he said.

But Assistant County Attorney Judith Hawley tried to poke holes in his story, noting that details changed when he explained what happened afterward. Scarsella also admitted going to the protest wearing a shoulder holster that made it easy for him to pull his gun, and that he had his jacket unzipped on the cold night.

She hammered him on why he didn't call 911 or report to the police after the shooting. Scarsella said it was because one of the friends in his group, Joseph Backman, told him later that he had called 911. But Hawley noted that Backman wasn't with Scarsella at the time of the shooting.

"So you chose not to go to police?" Hawley asked.

"I didn't have the presence of mind," he responded.

"Then you had the presence of mind to call Mr. Backman and say 'Come pick me up'?"

Racist texts raised in court

Hawley also hit Scarsella with numerous racist text messages he sent to friends in the year before the shooting. Though they had already been introduced in the trial, Hawley tried to use them to paint intent for the protest shooting.

One message talked about reloading a gun "to kill eight black guys." Another recommended putting a Confederate flag on a gun to "get a chimp to chimp out so you could shoot him."

In another, he wrote to a friend about riling up black people so he could gun them down.

"Once again you are texting about using a [gun] to kill black people?" Hawley asked.

"That's what we were talking about, yeah."

When Hawley asked if his texts were "just words," Scarsella said yes and that they didn't mean anything to him.

"So you can bandy around saying the N-word and it doesn't mean anything to you?" Hawley asked.

"I believe in freedom of speech," he responded.

He also said he was "ignorant" about the issues people of color face.

"I think that led me to the texts I sent," he said.

He described other texts as jokes "not meant to be taken seriously."

"They were private text messages between me and a friend, a friend who knew me very well," he testified. "They weren't meant to offend anybody, offend any kind of general audience; they weren't meant to be taken seriously, even by us.

"None of those things directed my actions," he added. "I never acted on any of those things."

Scarsella, 24, also testified that he attended the U.S. Military Academy at West Point for two years before he left because of a misconduct investigation. He also applied to become a Minnesota State Patrol trooper in 2014.

Along with Scarsella, Nathan Gustavsson, 22, of Hermantown; Daniel Macey, 27, of Pine City, and Backman, 28, of Eagan stand charged with second-degree riot and aiding an offender. Gustavsson took the stand in Scarsella's defense on Friday.

Under questioning by his attorney Laura Heinrich, Scarsella described the protesters as the antagonists that night.

Scarsella told the jury that at the protest, he and three friends quickly found themselves surrounded by an angry crowd, questioning whether they were with the police or KKK.

Men were wearing masks

Protesters earlier testified in the trial that they asked the men to take the masks off their faces. Scarsella said he didn't comply because "I didn't feel it would be prudent at the time."

After Scarsella took a punch to the cheek, the four started walking away from the crowd when Gustavsson got punched. Scarsella said he picked him up by the coat and kept walking north up Morgan Avenue. Scarsella said they saw a group of five to seven protesters break off and come after them.

Scarsella said he told them to get back "20 or 30 times." But he said the group continued to yell at them, threatening to beat them. "One said, 'White boy, you're going to die,'‚ÄČ" Scarsella testified.

About a block from where the confrontation started, he said he saw a man closest to him pull out what he believed was a weapon. Scarsella pulled out his gun and opened fire.

Under cross-examination, he said he didn't warn the protesters that he had a gun or that he was going to fire.

His testimony finished Monday; the defense is expected to continue its case on Tuesday.