A confrontation between the family of a murder victim and the family and friends of his accused killer had to be broken up by sheriff’s deputies Tuesday at the Leighton Criminal Court Building.

The shouting match began about 11:45 p.m. before the court call for 19-year-old Hector Aguirre, who is accused of fatally shooting 25-year-old Jamil Al Shaubi in December 2016 after allegedly mistaking Al Shaubi for a member of a rival gang.

When family of Al Shaubi entered the courtroom gallery, family and friends of Aguirre made a comment to one of Al Shaubi’s relatives, sparking the shouting match, according to several witnesses.

A witness said the two groups began to yell at each other and some members of the groups were getting ready to fight when Cook County sheriff’s deputies stationed in the courtroom intervened.

A spokesman for the sheriff’s office said two members of Al Shaubi’s family were briefly taken into custody because one of them spit on a member of Aguirre’s family and the other “took a fighting stance” during the confrontation. The member of Aguirre’s family who was spit on declined to press charges and both men were released.

Deputies separated the two groups, leading family of Al Shaubi outside the court building and telling them to leave. The group was escorted to the sidewalk in front of the court building, where several members argued with deputies, who blocked them from re-entering.

When at least two members of the group attempted to enter the building again, they were warned they would be arrested if they went inside. Deputies could also be seen trying to comfort and calm members of the group, with one deputy putting his hand on the shoulder of a man and talking with him.

Jamil Al Shaubi, who had no gang affiliation, was allegedly killed by Aguirre, a member of the Satan Disciples street gang, because Aguirre mistakenly believed that Al Shaubi was a member of the Latin Saints, prosecutors said at Aguirre’s bail hearing last month.

On Dec. 26, 2016, Aguirre got out of a stolen Jeep Commander with an assault-style rifle and fired at Al Shaubi as he walked with his two dogs in the 4400 block of South Hermitage, prosecutors said.

Al Shaubi was struck multiple times; one of his dogs was also killed in the attack, prosecutors said. Aguirre was charged with first-degree murder in the shooting and ordered held without bail on July 25.

At the time he was charged with Al Shaubi’s murder, Aguirre was serving a 10-year sentence at the downstate Pickneyville Correctional Center for aggravated battery with a firearm in a separate shooting he was found guilty of last year, according to prosecutors and state records.

Prosecutors announced Tuesday that Aguirre’s case had been superseded by indictment. His next hearing was set for Aug. 23, where he will be assigned a courtroom and enter a plea.