NEW YORK — Intel CEO Brian Krzanich has resigned after the company learned he had a consensual relationship with an employee.

The company said in a statement Thursday:

“Intel was recently informed that Mr. Krzanich had 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. 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 joined Intel  in 1982 as an engineer. He had been Intel’s top executive since 2013.

Intel’s board named Chief Financial Officer Robert Swan interim chief executive officer, effective immediately.

In this #MeToo era, corporate America is under intense pressure to enforce workplace policies on gender equality and sexual harassment.

Earlier this month, Guess Inc. co-founder Paul Marciano stepped down following a company investigation into allegations of sexual harassment and assault.

John Lasseter, co-founder of Pixar Animation Studios and Walt Disney’s animation chief, also recently said he was resigning over what he called “missteps” with employees.

The abrupt departure of Krzanich overshadowed otherwise positive news for the $246 billion tech company.

Intel said Thursday that it expects to post a per-share profit of 99 cents in the second quarter, 13 cents better than Wall Street was expecting, and revenue of $16.9 billion, which is also better than had been projected by industry analysts.