An off-duty Contra Costa County sheriff’s deputy and blues musician was arrested and later fired after shooting a handgun outside a party in Sacramento, authorities said Monday.

Kyle Rowland, 23, a rookie deputy who lives in Sacramento and recently started commuting to his new job in the Bay Area, was attending a small gathering late Thursday at a home in his downtown neighborhood. He left the party briefly, possibly after a dispute, only to return after midnight with two firearms, according to the Sacramento Police Department.

His return to the party created a “disturbance” and a confrontation ensued between Rowland and others at the house, police said. During the ruckus, Rowland fired a handgun “multiple times,” police said.

“Thankfully no one was struck by the gunfire,” said Officer Matthew McPhail. “One of the people at the party immediately intervened and attempted to physically restrain him, which is a pretty courageous thing to do if you’re not armed.”

When Sacramento police arrived at the home on the 1100 block of G Street, Rowland was being held down by the man who intervened. His mugshot taken after his arrest showed his face, particularly his right eye, bruised and bloodied.

Rowland was booked on suspicion of attempted murder and was still being held Monday in Sacramento County’s main jail. He is scheduled to be arraigned in Sacramento County Superior Court on Tuesday afternoon.

The Contra Costa County Sheriff’s Office said Sunday that Rowland was terminated after the arrest. He had been on the job since October.

Detectives were looking into whether the guns he allegedly brought to the party belonged to him or the sheriff’s office.

Rowland is a harmonica player and frontman for the Kyle Rowland Blues Band. The band is popular on California’s blues festival circuit and regularly plays gigs in the Sacramento and San Francisco areas.

Kurtis Alexander is a San Francisco Chronicle staff writer. Email: kalexander@sfchronicle.com Twitter: @kurtisalexander