Kris Kobach made his way through a parade in Johnson County Saturday morning, waving from an American flag colored jeep with a large gun mounted in back.
The city of Shawnee later issued an apology for Kobach's display.
The sight of Kobach, a Republican candidate for Kansas governor, in the vehicle at the Old Shawnee Days parade stunned some onlookers and quickly sparked criticism on social media.
“It was pretty shocking," said pastor Johnny Lewis of Shawnee Community Christian Church. "There were audible gasps from the folks we were sitting by.”
Lewis said he respects the views of people on both sides of the Second Amendment debate, but found the display inappropriate in a crowd filled with kids at a time when many of them, like his 6-year-old daughter, are scared that they might be victims of a school shooting.
"Why was that necessary sir?" Lewis said on Facebook, directing his comments at Kobach. "My child didn’t need that today."
Kobach's campaign was quick to defend the candidate's decision to wave at the crowd standing next to what appeared to be a .50 caliber machine gun.
"The gun is a replica," Kobach spokeswoman Danedri Herbert said in a text message.
"The Secretary says those who use the excuse of school violence to restrict the right to bear arms are deeply misguided. We need to stand up for our Second Amendment rights and recognize the only thing that stops a bad guy with a gun is a good guy with a gun."
Kobach's ride was among 115 entries in the parade down Nieman Road and Johnson Drive, which began at 10 and finished a little more than 90 minutes later.
The pro gun-control group Moms Demand Action was also represented. Jo Ella Hoye, a leader of the Kansas chapter, was among those wearing orange to raise awareness about gun violence.
"I'm sure that people felt happy to see it," Hoye said of the replica gun on the Jeep. "Some people might have been afraid to see it."
She said Kobach is the one who is misguided regarding "what national gun violence awareness day is or what people working to prevent gun violence are doing."
The city of Shawnee issued a written apology in response to growing criticism on Twitter and Facebook, which read in part:
"We want to apologize for the concern and frustration involved with Mr. Kris Kobach's parade entry at the Old Shawnee Days Parade on Saturday, June 2, 2018. In no way does this or any parade entry or float directly reflect the views and values of the City, the Old Shawnee Days Board or the Old Shawnee Days Society.
"Again, we apologize and understand the concern this caused. We have reached out to Mr. Kobach's media contact in an effort to get answers. Please know that the safety of our residents is always our highest priority and we apologize if this made anyone feel unsafe or unsettled. We will be taking steps in the future to try to ensure something similar does not happen again."
Kobach is an ardent defender of gun rights. In April, he held a pro-gun-rights rally on the steps of the Kansas Capitol on the same day students nationwide had walkouts for gun control.
While students walking out for gun control watched Kobach's event in Topeka, he gave a speech saying: "Instead of walking out of class, why don't you stay in class and spend that half hour studying the history of the Second Amendment?"
Kobach, the Kansas Secretary of State, is running against Gov. Jeff Colyer, Insurance Commissioner Ken Selzer and former nominee Jim Barnett for the Republican nomination.