A sword-wielding assailant slashed a man in the hand after grabbing the victim’s red “Make America Great Again” hat during an altercation outside a popular roller-skating rink in San Francisco’s Western Addition on Friday, officials said.

Police are hunting for the attacker, who fled the scene outside the Church of 8 Wheels on Fillmore and Fell streets, leaving his victim bleeding profusely on the sidewalk outside the crowded neighborhood skating spot.

Investigators were searching for security video and speaking to witnesses Saturday as they tried to piece together the details of the bloody confrontation that unfolded during the rink’s Friday night adults-only roller disco.

Officers were called to the scene around 9:50 p.m. on the report of a stabbing, said Officer Robert Rueca, a San Francisco police spokesman. They learned that the victim, whose name was not released, had been approached by another man and the two got into a verbal dispute, he said.

During the altercation, the assailant pulled off the victim’s “Make America Great Again” hat, a symbol of President Trump’s 2016 presidential campaign, and then whipped out a sword and slashed him, Rueca said.

David Miles, who goes by the nickname “Sk8father” and started the roller rink at the former Sacred Heart Catholic Church, was inside during the dispute. He said he didn’t see the attack but ran out to help the victim.

“I came outside. The guy was cut, he was bleeding like you wouldn’t believe,” Miles said Saturday. “He was just gushing blood, so we got the first aid kit from inside and tried to stop the bleeding.”

Paramedics quickly arrived and took the victim to a hospital, where he was treated for non-life-threatening injuries, police said. Miles said officers asked him if a man dressed as a pirate had come into the church, but he hadn’t seen anyone like that.

Miles posted pictures of the bloody aftermath of the attack on Facebook, showing the red hat near a pool of blood. The victim had apparently chased his attacker before realizing how badly he was bleeding, he said.

“This is the last thing you think is going to happen,” he said. “I’m very, very, very concerned. I don’t really know what to think.”

Police are asking anyone with information about the attack to call investigators at 415-575-4444.

Gwendolyn Wu and Evan Sernoffsky are San Francisco Chronicle staff writers. Email: gwendolyn.wu@sfchronicle.com, esernoffsky@sfchronicle.com Twitter: @gwendolynawu, @EvanSernoffsky