The next-to-last day of the 2018 racing season at the Del Mar Fairgrounds was interrupted by gunfire hours before rapper Ice Cube was set to take the stage Sunday.

The San Diego County Sheriff's Department said 22-year-old Daniel Elizarraras, of Escondido, came to the ticket window attempting to purchase a ticket to the post-race concert.

He was told the concert was sold out and began an argument that drew the attention of nearby deputies.

At that point, Elizarraras pulled out a silver plated semi-automatic handgun and fired several shots near a crowded area.

Witnesses captured video of the event and shared it with NBC 7. Warning, the video may be graphic.

Video courtesy Taylor Hamilton.

Sheriff's deputies reacted to the disturbance and one returned fire. The deputy involved has not been identified.

Elizarraras was hit multiple times in the torso and arm, SDSO said.

Elizarraras was taken to Scripps Memorial Hospital La Jolla. His condition was not known but SDSO said he is expected to survive his injuries. No other suspects are outstanding and no deputies or civilians were hit.

He was booked into jail at 7:07 a.m. Monday with bail set at $100,000.

One witness, James Hairston III, told NBC 7 the man fired three shots before deputies tased him.

"The guy took out the gun, put it up in the air, and fired three times. Then 'pop, pop, pop,'" Hairston told NBC 7.

Hairston said deputies tased the man first and the man dropped the gun.

"At that point, the deputies shot him three times," Hairston said.

More bystander video shows law enforcement officers performing chest compressions on the man after the incident.

Lt. Karen Stubkjaer told NBC 7 the Sheriff's office is aware of the videos posted to social media, and that public safety is the number one priority.

"Deputies were here for the sole purpose of protecting life and property," Stubkjaer said.

The shooting happened during the 10th and final race of the day at the Del Mar Racetrack. On the TVG broadcast of the race the announcers were heard saying, "There's gunfire at the track, there's gunfire at the track, there is gunfire at the..." before the microphone was cut off. The crew was unharmed.

Rapper Ice Cube was set to take the stage in hours when gunfire erupted during Del Mar Racing's last race of the day. NBC 7's Mackenzie Maynard reports.

Vice President of Marketing, Carrie Jones, of the Del Mar Thoroughbred Club released a statement, saying the club is fully cooperating with the Sheriff's office.

"We will continue to fully cooperate with the Sheriff's Department in its investigation," Jones wrote to NBC 7.

Jones said the final day of racing will begin at 2:00 p.m. Monday as scheduled.

The Ice Cube concert went on as planned, without any other incidents, though with a smaller crowd than expected.

The rapper responded to the incident on Twitter Monday, replying to a fan that said they were glad Ice Cube was not hurt in the incident.

"Thank you. I feel bad for the people who left the show, but I totally understand. Moral of the story: Come see ya homie Cube...but leave the strap at home," he said.