Bill Gates called his relationship with the late Jeffrey Epstein a “huge mistake” and that he regretted having dinner with the sex offender on several occasions in an interview with CNN.

The billionaire co-founder of Microsoft Corp. said the two had met to discuss a philanthropy project, but their meetings stopped after the likelihood of getting funding diminished.

Gates is grappling with the fallout from his divorce from his wife of 27 years, Melinda French Gates. Since they announced plans to end their marriage in May, Bill Gates has been confronted with reports of infidelity and accusations that his money manager Michael Larson operated a toxic work environment.

The New York Times reported in October 2019 that the billionaire had met with Epstein several times starting in 2011, and once stayed late at his New York townhouse. By this time, Epstein had already pleaded guilty to two prostitution charges.

A spokeswoman for the Microsoft co-founder said at the time that the meetings had centered on philanthropy. Epstein had died in jail in August 2019 while awaiting trial on federal charges related to sex trafficking.

Gates said in the interview with CNN that he and his wife would try and work together on Bill & Melinda Gates Foundation, and that he should not have given Epstein “credibility” by spending time with him.