Apple CEO Tim Cook participates in an American Workforce Policy Advisory Board meeting with U.S. President Donald Trump and others in the White House in Washington, March 6, 2019.

A former Apple executive alleges the company illegally gathered private text messages from his iPhone before firing him for breach of contract.

Gerard Williams, who led design of all the chips powering Apple's mobile devices, left the company in February after nine years to head up Nuvia, a new server chip start-up. Nuvia, which is building silicon chips for data centers, announced in November that it secured $53 million in funding.

Apple filed a lawsuit against Williams in August for breach of contract, claiming an intellectual property agreement prevented him from planning or engaging in any business activities that would compete with the company. In the lawsuit, filed in Santa Clara Superior Court in California, Apple argues Williams' work around Nuvia was competitive to Apple because he recruited "numerous Apple engineers" away from the company.

In his response, Williams argues Apple illegally collected text messages between him and other Apple employees, two of which went on to be Nuvia's co-founders, to build its case.

"Apple, an early beneficiary of the creative forces that formed and continue to drive Silicon Valley, has filed this lawsuit in a desperate effort to shut down lawful employment by a former employee," the lawsuit states. "To further intimidate any current Apple employee who might dare consider leaving Apple, Apple's complaint shows that it is monitoring and examining its employees' phone records and text messages, in a stunning and disquieting invasion of privacy."

Apple contends that Williams used his experience at the company to "start a competing company leveraging the very technology the director was working on." The company is seeking injunctions and punitive damages against Williams for breach of contract and breach of duty of loyalty.

Williams' allegation that Apple searched his text messages contradicts the company's repeated commitments to privacy. In recent months, Apple has dialed up its pro-privacy messaging, in an effort to differentiate itself from other tech companies that have mismanaged users' data. In one example, Apple ran an advertisement pledging "what happens on your iPhone, stays on your iPhone."

Apple was not immediately available to comment.