Republican Iowa State Senator and Senate candidate Joni Ernst referred to last Friday's mass shooting at UC Santa Barbara as an "unfortunate accident" during a televised primary debate Thursday evening. Ernst discussed the shooting, which left seven people dead, when the moderator asked about one of her ads, which features her at a gun range.

"Mrs. Ernst, a viewer wrote us saying in light of the shooting of Congresswoman Gabby Giffords, the shootings at the Aurora, Colorado, theater, and most recently at the UC Santa Barbara campus, quote, 'we have a Joni Ernst in the television ad that is running continuously on all local television stations that contains violent imagery pointing a gun directly at the viewer and vowing to quote ‘shoot them down’ and hateful language directed toward their opponents. Is this really what politics has become in this country?' Mrs. Ernst, what do you say to this viewer?" the moderator asked.

Ernst initially referred to the UCSB shooting as a "tragedy."

"Yes, I would say to this viewer that what happened in that shooting and that stabbing is an absolute tragedy, however I remain firm in my commitment to the Second Amendment," said Ernst. "I have been endorsed by the NRA in this race and again just because of a horrible, horrible tragedy, I don’t believe we should be infringing upon people’s Second Amendment rights. I will stand firmly behind that when I go to Washington, DC, as your next United States Senator."

The moderator followed up and asked Ernst whether she would "change the ad or the timing of it." Ernst said she would not and went on to refer to the shooting as an "unfortunate accident."

"This unfortunate accident happened after the ad, but it does highlight that I want to get rid of, repeal, and replace Bruce Braley’s Obamacare and it also shows that I am a strong supporter of the second amendment. That is a fundamental right," said Ernst.

In a statement to Business Insider Ernst spokeswoman Derek Flowers said Ernst believes the shooting was a "tragedy."

"As she said when she first answered the question, Joni believes that this was a terrible tragedy. It's outrageous that Democrats are politicizing and playing gotcha politics with this tragedy," Flowers said.

Iowa's Republican primary will take place June 3. Recent polling has showed Ernst is a clear frontrunner in the race.

Watch a video of Ernst discussing the UCSB shooting below.