A former Republican candidate for Michigan governor pleaded guilty to misdemeanor charges related to the Jan. 6, 2021, insurrection Thursday.

Ryan Kelley, who placed fourth in Michigan’s 2022 gubernatorial primary with 15 percent of the vote, was arrested last June after anonymous tipsters gave photos to the FBI showing that he was present at the Capitol.

Federal investigators said Kelley was part of the crowd that rushed the Capitol, forcing police to retreat up the stairs and into the building. He directed parts of the crowd to and around the Capitol but did not enter the building himself, investigators said.

Kelley initially pleaded not guilty to a slate of charges including entering a restricted area and destruction of government property. He pleaded guilty to the restricted area charge this week in an agreement that saw other charges dropped.

He is scheduled to be sentenced on Oct. 17.

Before the insurrection, Kelley was a prominent “Stop the Steal” activist in Allendale, Mich. At a rally there in November 2020, after the election, he gave a speech sowing doubt about the vote and denying the veracity of the coronavirus pandemic.

“COVID-19 was made so that they can use the propaganda to control your minds so that you think, if you watch the media, that Joe Biden won this election. We’re not going to buy it. We’re going to stand and fight for America, for Donald Trump. We’re not going to let the Democrats steal this election,” he said, according to prosecutorial documents.

At the time of his arrest in 2022, Kelley was the leading candidate for the GOP gubernatorial primary, according to polling.

In a primary debate, Kelley acknowledged that he was in Washington on Jan. 6, but denied any wrongdoing.

“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,” he said. “And that’s what 99 percent of the people were there for that day.”

“January 6, 2021, back when gas was under two dollars a gallon, those were good times,” he added.

Kelley ended up receiving 165,000 votes in the primary, placing fourth behind Tudor Dixon, who went on to be defeated by Gov. Gretchen Whitmer (D).

Kelley’s lawyer said he plans to return to Michigan and continue his career as a commercial real estate agent.

“He never went into the Capitol, he never hurt anybody … and there is no suggestion otherwise,” attorney Gary Springstead said.