(CNN) This is a story about how political operatives tried to take down a presidential candidate, and ended up just humiliating themselves.

It's also a story about how a smear was spread by right-wing websites -- and was cleaned up by newsrooms that took some time to check the facts.

On April 29 someone shared a post titled "Pete Buttigieg Sexually Assaulted Me" on Medium, a site that lets anyone upload stories, essays and any other bit of text. It was attributed to a college student named Hunter Kelly.

Within hours, the fake allegation against the South Bend, Indiana mayor and Democratic presidential candidate would begin to crumble, and the real story -- the story of the smear campaign -- would emerge.

But by then, the Medium post already had 12,000 Facebook interactions. It ricocheted around the right-wing internet, thanks to sites like Big League Politics, InfoWars, NewsWars and The Gateway Pundit, potentially reaching millions of readers, according to a media analysis from Ben Decker, CEO of the digital investigations firm Memetica.

According to Kelly, the scheme started when Jacob Wohl, a far-right internet personality, messaged Kelly on Instagram. "Do you want to be part of a political operation?" the message said, according to a copy reviewed by CNN.

Kelly, a 21-year-old, gay, Donald Trump-supporter, was intrigued. On Sunday, the Michigan native took a late flight to the Washington area booked for him by Wohl and Jack Burkman, a Republican lobbyist and a conspiracy theorist.

When Kelly arrived, he was taken to Burkman's home. In a later interview with CNN, he alleged that Wohl and Burkman wanted to take down Buttigieg, whom they viewed as President Trump's top threat in 2020.

Burkman had been fixating on Buttigieg on social media. On April 22, Burkman tweeted, "2020 is shaping up to be more exciting than 2016. Looking like it will be Trump vs. Mayor Pete! Get the popcorn ready!" He mused on his internet radio show that Buttigieg had eclipsed Beto O'Rourke as the star of the Democratic field.

By the time Kelly arrived at Burkman's house it was the middle of the night, Kelly said. But they spent the pre-dawn hours Monday going over their plan anyway. Wohl showed Kelly a draft of the Medium post. Kelly said he told Wohl "I was incredibly uncomfortable and not on board with their plan."

It was late when Kelly went to sleep. When he woke up, around 11 a.m. Monday, he said Wohl had already posted the article under Kelly's name.

"Next thing I know, Jack Burkman is telling me how I am a 'star' and people are eating me up," Kelly said, adding that he felt "sick to my stomach" about the article.

Jack Burkman and Jacob Wohl in 2018.

Kelly accused the men of creating a fake Twitter account under his name, @realHunterKelly, and sharing the link to the article. (Twitter later suspended the account.) David Wohl, Jacob Wohl's father, was also quick to share it on Twitter.

Reporters from mainstream news outlets saw it, and some newsrooms, including CNN, sought more information. But they held off on publishing or broadcasting anything, given that the claim was out of the blue and completely unsubstantiated.

'Politics can be ugly'

Some right-wing websites, however, ran with it right away. "Mayor Pete Hit with #MeToo Allegation of Sexual Assault," InfoWars wrote . "Democrat Darling Pete Buttigieg Accused of Sexual Assault by 21-Year-Old from Michigan," said The Gateway Pundit's headline.

Around 2 p.m., three hours after the allegation was posted, Buttigieg held an unrelated Q&A with reporters in New York City. "Mayor Pete, do you have anything to say about the allegations?" a reporter asked.

"Oh, I'm sure it's not the first time somebody's going to make something up about me," Buttigieg said. "It's not going to throw us. Politics can be ugly sometimes, but you have to face that when you're in presidential politics."

As Buttigieg was responding, Kelly said he was receiving hundreds of calls and messages from reporters about his claim. He returned CNN's call around 4 p.m. Kelly sounded nervous on the phone and said he only wanted to talk on-camera. Later, he would tell CNN that Burkman and Wohl were standing over his shoulder, forcing him to read a script.

Kelly sent an address to CNN for the interview. It was Burkman's home, which immediately raised red flags. Burkman helped fuel the Seth Rich conspiracy theories. Last year, Burkman and Wohl had worked together to try to pin a fake sexual assault allegation on special counsel Robert Mueller. The matter was referred to the FBI for investigation.

When CNN asked Kelly for some corroboration of his claims before agreeing to do an interview, Kelly didn't respond. Around 7:30 p.m., Kelly texted: "I was set up."

In a statement sent to CNN and posted to Facebook, Kelly wrote, "It's important for everyone to know that I was not sexually assaulted and would never falsely accuse anyone."

Burkman and Wohl both denied that they were part of a plot to fabricate sexual assault allegations against Buttigieg.

"I am appalled by the lies now being told in the national media," Burkman tweeted. "Hunter Kelly's claims of 'coercion' are absurd. He spent a pleasant day with our firm. The day included a Starbucks run, getting him to a hair salon, and playing with dogs."

Burkman shared a photo of a statement Kelly signed describing the assault as well as a photo of Kelly posing with his Ferris State University ID. Burkman described Kelly as his "client" and said he was only trying to help Kelly get the story out.

Wohl told CNN that Kelly "came here to Washington. He had a very detailed story about how he was sexually assaulted by Mayor Pete Buttigieg. We vetted his allegation in a cursory way, and basically transcribed it. After which he signed onto it."

Something more nefarious

In follow-up conversations, Kelly described something more nefarious. He said he didn't know what to do when Wohl first presented him with the draft of the Medium post.

"It was almost four in the morning," Kelly said. "I couldn't get kicked out because I would have had nowhere to go. By the time I woke up, security was there, and I just felt very uncomfortable."

He said if news outlets had sent camera crews, he had a plan to expose Wohl and Burkman during the interview.

"I was going to point at both of them and say, 'I'm being set up right now and none of this is true,'" Kelly said. "I felt like that would have made them look like the liars that they are."

Noting his misgivings, Kelly said that Burkman promised him a "lavish lifestyle" if he played his part in the scheme.

Instead, Kelly said that he pretended to be exhausted. He said he needed a nap but instead he packed his things and waited for some of his family members to arrive. Then, Kelly said, he rushed downstairs and told Wohl he couldn't go through with their plan. He left the house and headed back to Michigan.

CNN could not independently verify Kelly's story about the financial promises Burkman allegedly made or the pressure Kelly allegedly faced to go along with the plan.

By both Wohl and Kelly's accounts, Kelly was in touch with his family throughout this saga and eventually left Burkman's house with family members, though Wohl claims that Kelly only retracted the allegations after he faced pressure from his family.

Just before 8 p.m., The Daily Beast published a story exposing the hoax. Right-wing websites began updating their initial stories about the made-up assault allegation. By about 10 p.m., Medium removed the story that set everything in motion. It was taken down without any explanation -- perhaps because it violated the site's rule against deceptive content.

In follow-up conversations, Kelly said he had been excited to participate in a legitimate research and political operation. He said it seemed like "a really awesome opportunity."

Kelly also admitted that when he agreed to hop a plane to Washington, he was already aware of the kinds of stunts Burkman and Wohl had pulled in the past. He just didn't believe he would ever allow himself to get sucked into one.

"I knew that I would never let that happen. But I let it happen," Kelly said. "It was definitely something I wish I could take back, going out there. But I can't, so I'm trying to right my wrongs, let the truth be told."

Now, when someone searches for information about the allegation on Google, stories debunking the smear show up before the smear itself -- a small victory for Buttigieg and for the truth.

--CNN Business' Donie O'Sullivan and Oliver Darcy contributed to this report