Patrick Byrne resigned Thursday as CEO of Overstock.com. (George Frey/Bloomberg)

The chief executive of Overstock.com resigned Thursday, saying he was “far too controversial” after disclosing that he had aided in a “deep state” investigation into the 2016 election and was romantically involved with a Russian agent.

Patrick M. Byrne had led the e-commerce retailer for two decades.

“Though patriotic Americans are writing me in support, my presence may affect and complicate all manner of business relationships,” he told shareholders in a letter Thursday. “Thus, while I believe that I did what was necessary for the good of the country, for the good of the firm, I am in the sad position of having to sever ties with Overstock.”

Byrne confirmed in a company news release last week that he had been romantically involved for three years with Maria Butina, a Russian gun rights activist who is now serving 18 months in prison for trying to influence U.S. policy ahead of the 2016 election. He also said he had been aiding federal authorities, whom he called “the Men in Black,” in their “Clinton investigation” and “Russia investigation.”

The investigation “turned out to be less about law enforcement and more about political espionage conducted against Hillary Clinton and Donald Trump (and to a lesser degree, Marco Rubio and Ted Cruz),” he said in a statement last week. He did not provide more specifics.

Byrne handed over a number of text messages, emails and other documents to the U.S. Department of Justice earlier this year, according to an article published last week by Sara Carter, a journalist and Fox contributor. Carter also reported that Byrne has a low-level security clearance and told the FBI of his early encounters with Butina. The FBI, Byrne told Carter, gave him “vague instructions that it would be ok to get to know her better.” Byrne confirmed those details in a news release. An FBI spokeswoman declined to comment, as did Butina’s attorney, Robert Driscoll.

Shares of Overstock.com fell 36 percent following the initial disclosures. On Thursday, the stock jumped more than 9 percent.

In a meandering and sometimes bizarre letter, Byrne said he had been thinking about resigning since July 2018, when “certain news became public.” That month, Butina was arrested by the FBI.

“If the hors d’oeuvre that was served recently caused the market such indigestion, it is not going to be in shareholder interest for me to be around if and when any main course is served,” Byrne wrote in his resignation letter.

“I wish all shareholders a smooth and level road,” he concluded. “And don’t forget to shop Overstock.com!”

Jonathan E. Johnson III, who oversees the company’s blockchain subsidiary, has been appointed interim chief executive, Overstock.com said. Kamelia Aryafar, Overstock’s chief algorithms officer, will replace Byrne on the company’s board.

Overstock got its start in 1997 as an Internet marketplace for excess inventory. Byrne took over the Utah-based company in 1999 and turned it into an e-commerce giant that specializes in home goods, furniture and decor. Sales rose 4 percent last year to $1.82 billion.

Byrne, a longtime advocate of cryptocurrencies, has been building up Overstock’s blockchain business. The company became the first mainstream retailer to accept bitcoin in 2014, and is developing an e-commerce token called tZero. Byrne has recently become outspoken about his plans to resell Overstock’s e-commerce business to focus on blockchain.

Now, with Byrne’s departure, analysts said they expected the company to move quickly in selling off its retail operations.

“This is a tremendous day for shareholders,” said Tom Forte, an analyst for D.A. Davidson & Co. “To Patrick Byrne’s credit, he realized that the controversy was having a negative impact on his company and he stepped down. Now the company can move forward.”

Devlin Barrett contributed to this story.