Intel says CEO Brian Krzanich has resigned after the company learned of a "past consensual relationship with an Intel employee."

"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 an announcement on Thursday.

Chief Financial Officer Robert Swan will serve as interim chief executive officer, effective immediately.

A source familiar with the matter said the company has a strict non-fraternization policy that prevents managers from engaging in relationships with employees. Employees who see inappropriate workplace behavior are required to report it to management.

The source said Intel recently learned of Krzanich's past relationship with an employee.

The Intel board said it accepted Krzanich's resignation, noting all employees are expected to respect Intel's values and code of conduct.

Krzanich, 58, joined the chipmaker in 1982 as an engineer. He became CEO and an elected a member of the board of directors in May 2013. Krzanich previously served in senior leadership roles, including COO, at Intel.

Earlier this year, he came under fire for selling about half his stock after learning that critical flaws affected Intel's microchips. But the company publicly said the stock sale was not related to chip's issues.

Related: Intel CEO: Let's turn 'tragedy into action'

Krzanich previously served on President Trump's now disbanded manufacturing council. In August, he and the CEOs of Merck (MKGAF) and Under Armour (UA)stepped down after fallout over Trump's response to violence at a white nationalist rally in Charlottesville, Virginia.

"I resigned because I want to make progress, while many in Washington seem more concerned with attacking anyone who disagrees with them," he said at the time.

Krzanich had previously stressed the importance of engaging with the government. In February 2017, he stood next to the president in the White House to announce a $7 billion investment in a new US factory.

In addition to the news about Krzanich's departure on Thursday, Intel raised its second quarter guidance from its previous forecast. It expects revenues of about $16.9 billion with adjusted earnings of $.99 a share.

Still, Intel stock dipped as much as 2% on Thursday morning after the news broke.