Intel’s Brian Krzanich was forced out as CEO following an investigation into a “consensual relationship with an Intel employee,” the company announced Thursday.

Krzanich has also left the board, it said.Chief financial officer Robert Swan will step in as interim CEO, effective immediately, and the board has already begun the search for a permanent replacement.

“An ongoing investigation by internal and external counsel has confirmed a violation of Intel’s non-fraternization policy, which applies to all managers,” the company said in a statement. “Given the expectation that all employees will respect Intel’s values and adhere to the company’s code of conduct, the Board has accepted Mr. Krzanich’s resignation.”

Krzanich violated a policy that said managers cannot have relationships with people who report to them either directly or indirectly. The relationship ended and took place “some time back,” people familiar with the situation told us. It’s unclear with whom Krzanich, 58, had the relationship.

What CEO Brian Krzanich's departure means for Intel

The company was only recently made aware of the relationship, at which point it began probing and Krzanich was asked to resign, the people said.

Krzanich’s total compensation topped $21 million last year, and the company paid for his transportation and residential security, according to company filings.

Shares of Intel initially rose 2 percent in premarket trading after the announcement but was down 1.8 percent in morning trading.

Krzanich was named CEO and elected to the board in May 2013, according to a summary of his biography on Intel’s website. Before that, he served as executive vice president and chief operating officer. He joined Intel in 1982.

He led Intel’s transformation from a PC-centric to a data-focused company, delivering the technology foundations for the new data economy, according to the company’s most recent 10K statement.

“The Board believes strongly in Intel’s strategy and we are confident in Bob Swan’s ability to lead the company as we conduct a robust search for our next CEO,” Intel Chairman Andy Bryant said in a statement. “Bob has been instrumental to the development and execution of Intel’s strategy, and we know the company will continue to smoothly execute. We appreciate Brian’s many contributions to Intel.”

Intel’s stock has risen about 120 percent during Krzanich’s tenure as CEO.

Also Thursday, Intel raised its guidance for the second quarter. The company said it now expects adjusted earnings of 99 cents per share on $16.9 billion in revenue. Intel previously forecast second-quarter earnings of 85 cents a share on $16.3 billion in revenue.

Article By David Faber and Jordan Novet