A California venture capitalist who donated big bucks to both President Trump and Hillary Clinton gave millions in illegal campaign contributions, some funneled from foreign sources, in an effort to influence high-level US government officials, federal prosecutors said Tuesday.

Imaad Zuberi, 49, has agreed to plead guilty to tax evasion, falsifying records to hide his work for foreign governments, and giving almost $1 million in illegal contributions to various election campaigns, the US Attorney’s Office for the Central District of California said.

“Mr. Zuberi’s multifaceted scheme allowed him to line his pockets by concealing the fact that he was representing foreign clients, obtaining access for clients by making a long series of illegal contributions, and skimming money paid by his clients,” United States Attorney Nick Hanna said.

“Mr. Zuberi circumvented laws designed to insulate U.S. policy and our election process from foreign intervention.”

Charging documents don’t specify which candidates received the illegal funds, some of which came from foreign entities, between Sept. 2011 and Nov. 2016.

A prolific political donor, Zuberi mostly raised money for Democrats before switching his allegiance to Trump around the 2016 election — eventually donating $900,000 to the president’s inaugural committee. It’s unclear where that money came from.

Zuberi partied with top politicians including Clinton, Joe Biden, Barack Obama and Sen. Lindsey Graham, according to his since-deleted social media posts reviewed by the Associated Press.

In one photo, he sat next to Robert De Niro at a dinner with Clinton and in another he chatted with Treasury Secretary Steven Mnuchin in Trump Tower.

Over the years, feds say Zuberi solicited money from foreign nationals, showing off photos of himself with elected officials as proof of his connections and ability to influence US policy to benefit them.

As part of his scheme, he hired lobbyists, public relations professionals and more, at the same time gaining access to high-level US officials.

Some government officials were willing to adopt the positions he advocated for, though his efforts “generated marginal results,” prosecutors said.

The scheme earned him millions of dollars — most of which he looted from his clients, feds say.

If convicted of the three counts, Zuberi faces up to 15 years in prison. He is due in court Oct. 30.