A California man was arrested Wednesday after he allegedly slashed another man with a sword following a spat over a “Make America Great Again” hat, San Francisco police said Thursday.

Leor Bergland, 30, of San Francisco was arrested in a restaurant by officers who had been staking out his neighborhood since the incident, which allegedly occurred Friday, March 29. Police said the suspect surrendered without incident.

The alleged sword attack happened when a 27-year-old Berkeley man and Bergland encountered each other outside the popular Church of 8 Wheels, a roller-skating rink inside an old church in San Francisco’s Fillmore district, police said.

MAN WEARING 'MAGA' HAT SAYS WOMAN BERATED HIM AT CALIFORNIA STARBUCKS FOR SUPPORTING TRUMP

Bergland drew a sword and slashed the man's hand after he knocked Bergland’s hat -- which bore President Trump’s iconic campaign slogan -- to the ground, police said. The man and another person pursued Bergland but stopped after Bergland turned on them and brandished a sword, police said.

The slashing victim, who was not named, was treated and released from a hospital, police said.

Bergland was booked on “suspicion of attempted murder, mayhem and weapons and assault charges,” the San Francisco Chronicle reported. His bail was set at $1 million.

The newspaper noted that this was not the first time Bergland was accused of “brandishing a blade.” In 2012, he was charged in two incidents in Oregon in one week.

MAGA-HAT WEARING TEEN CLAIMS CALIFORNIA HIGH SCHOOL WOULDN'T PERMIT HER TO WEAR HAT

Scott Sweeney told the San Francisco Chronicle that he was in the same neighborhood about 30 minutes before the incident and saw a man with a MAGA hat and a sword tucked into the back of his jacket.

The man, Sweeney said, was shouting homophobic slurs at him.

"In my mind I didn't think it was a real sword until we came out later and police were on the scene and there was blood and the hat on ground," he said.

The Associated Press contributed to this report.