A Republican candidate for Michigan governor pleaded not guilty Thursday for his actions during the insurrection at the U.S. Capitol on Jan. 6, 2021, when he says he and other supporters of then-President Donald Trump were exercising their free speech rights.

Ryan Kelley appeared via video for a brief hearing in federal court, weeks after the real estate broker was arrested at his home in western Michigan and charged with several misdemeanors for his role in the riot.

Kelley said little during the hearing, but at a debate Wednesday night he said he and others at the Capitol were unhappy with the 2020 presidential election, when Trump lost to Democrat Joe Biden.

“That was a First Amendment activity by a majority of those people, myself included,” Kelley said. “We were there protesting the government because we don’t like the results of the 2020 election, the process of how it happened. And we have that First Amendment right. And that’s what 99% of the people were there for that day.”

Kelley is accused of disruptive conduct, injuring public property and entering restricted space without permission.

Federal investigators said Kelley was recorded on video outside the U.S. Capitol on the day of the insurrection, repeatedly waving to the crowd and directing them toward stairs leading into the building. He used his phone to “film the crowd assaulting and pushing past U.S. Capitol police officers” and was in a crowd that climbed stairs to a Capitol entrance after causing police to retreat, the FBI said.

Kelley was a little-known candidate in a field of five Republicans vying for the GOP nomination on Aug. 2 to face Democratic Gov. Gretchen Whitmer in November.

He has said he believes the arrest and accompanying publicity helped increase his name recognition and gain supporters. Kelley also has questioned the timing of the charges, which were filed about a year and a half after the Capitol riot. He says they are politically motivated and that he is being targeted by the Biden administration and others on the left.

Kelley decided to run for governor after leading protests against Whitmer and restrictions she imposed during the coronavirus pandemic. They included a rally at the Michigan Statehouse in Lansing, where heavily armed militias entered the building.