Two of Donald Trump’s closest former aides have ties to a firm that tried to help the Russian government spy on its own people, sources told The Post.

Former Trump campaign Chairman Paul Manafort and ex-“core’’ aide Rick Gates have financial links to EyeLock, which lobbied Russian leader Vladimir Putin’s government in a bid to expand the country’s domestic spying program, sources said.

The Russians wanted to use “iris-reading’’ technology in their subways to scan riders’ eyes and ferret out those on “watch lists,’’ sources said.

The company planned to help Russia hide the iris-scanning machines throughout Moscow’s stations, sources said. Just one scanner could have secretly read and collected biometric data from as many as 50 people per minute.

The company didn’t win the contract. But its ties to Trump and Putin through the two men raises troubling questions over potential conflicts of interest, critic say.

“This is quite an unusual business relationship for senior presidential campaign staff members to have with a foreign government,” a former White House official told The Post.

“It raises a lot of questions about national security and what should have been publicly disclosed to get a better handle on ties between the Trump campaign and the Russian government.”

Trump has tried to downplay any potential issues involving his own business empire and the Russian government by insisting, among other things, “I don’t know Putin.’’

But his two aides were unable to distance themselves. Manafort resigned from the campaign in August amid growing heat over his ties to Ukraine’s pro-Russian government. Gates hung on a bit longer — till last month — before he also stepped down.

Through Manafort’s consulting company, David Manafort & Freeman, the pair had helped elect Viktor Yanukovich, Ukraine’s pro-Putin president.

The US Justice Department is now investigating whether the consulting company illegally used the US financial system to aid Yanukovich and his regime, according to reports.

As for EyeLock LCC, Manafort was a major early investor, four sources close to the company said.

Gates was hired by EyeLock as an independent contractor to build business in the Middle East, including Saudi Arabia and the United Arab Emirates, sources said. Gates has also worked for Manafort’s political consulting company in Ukraine.

Manafort invested as much as $1 million and owned about 10 percent of EyeLock as early as 2006, multiple sources said. His stake was diluted to less than 1 percent after EyeLock was acquired last year by Voxx International, according to a shareholder close to Manafort.

EyeLock’s push to get into the Moscow metro system was no different than working with the Federal Security Service, or FSB, the successor of the Soviet Union’s KGB, analysts told The Post.

“Really, the FSB is everywhere,” Steven L. Hall, who ran intelligence operations for the Central Intelligence Agency in Eurasia and Latin America for 30 years before retiring in 2015, told The Post. “If the Russian metro officials suspected anything difficult or problematic they would call the FSB.

“It would not surprise me, as a former intelligence officer, that the Russians are looking to have that capability,” he said.

While other countries use similar “iris-reading’’ technology at customs checkpoints, Russia wanted to covertly install it throughout its subway system in order to track those walking through, including everyone from US diplomats to journalists and tourists, sources said.

“They had some people on a naughty list, a black list, and they wanted to track these people,” a former executive told The Post. “It was more surveillance, hit a black-list database, send up an alert.”

While neither Manafort nor Gates were directly involved in the day-to-day operations at EyeLock, they were both aware of its plans to enter the Russian market, sources said.

In an interview before he left the Trump campaign, Gates said he was only involved in helping EyeLock procure US government contracts and had no involvement with Russia. He didn’t return a follow-up voice mail asking about his involvement in the Middle East.

Manafort didn’t return calls and an e-mail seeking comment. EyeLock, through a rep, denied that Manafort ever had any direct involvement or operational role with the company’s business.

“There is an entity which holds a minority interest in EyeLock LLC,” the company said through a spokesman, John Dillard. “The Company understands that Mr. Manafort has (or had) a .03% indirect interest in EyeLock LLC through that entity. The notion that small, indirect interest would give Mr. Manafort a financial incentive to attempt to act on behalf of EyeLock is preposterous.”

Investing in and working for a company that does business with Putin’s Russia is legal, and it appears that EyeLock didn’t run afoul of any sanctions.

Trump’s campaign said it was unaware of Manafort and Gates’ ties to EyeLock.

“Mr. Trump and the campaign have absolutely no knowledge of this, and these individuals are no longer with the campaign,’’ Hope Hicks, a Trump campaign spokeswoman, told The Post.