•A Chinese-owned company penetrated former Secretary of State Hillary Clinton’s private server, according to sources briefed on the matter.

• The company inserted code that forwarded copies of Clinton’s emails to the Chinese company in real time.

•The Intelligence Community Inspector General warned of the problem, but the FBI subsequently failed to act, Texas Republican Rep. Louie Gohmert said during a July hearing.

A Chinese-owned company operating in the Washington, D.C., area hacked Hillary Clinton’s private server throughout her term as secretary of state and obtained nearly all her emails, two sources briefed on the matter told The Daily Caller News Foundation.

The Chinese firm obtained Clinton’s emails in real time as she sent and received communications and documents through her personal server, according to the sources, who said the hacking was conducted as part of an intelligence operation.

The Chinese wrote code that was embedded in the server, which was kept in Clinton’s residence in upstate New York. The code generated an instant “courtesy copy” for nearly all of her emails and forwarded them to the Chinese company, according to the sources.

The Intelligence Community Inspector General (ICIG) found that virtually all of Clinton’s emails were sent to a “foreign entity,” Rep. Louie Gohmert, a Texas Republican, said at a July 12 House Committee on the Judiciary hearing. He did not reveal the entity’s identity, but said it was unrelated to Russia.

Two officials with the ICIG, investigator Frank Rucker and attorney Janette McMillan, met repeatedly with FBI officials to warn them of the Chinese intrusion, according to a former intelligence officer with expertise in cybersecurity issues, who was briefed on the matter. He spoke anonymously, as he was not authorized to publicly address the Chinese’s role with Clinton’s server.

Among those FBI officials was Peter Strzok, who was then the bureau’s top counterintelligence official. Strzok was fired this month following the discovery he sent anti-Trump texts to his mistress and co-worker, Lisa Page. Strzok didn’t act on the information the ICIG provided him, according to Gohmert.

Gohmert mentioned in the Judiciary Committee hearing that ICIG officials told Strzok and three other top FBI officials that they found an “anomaly” on Clinton’s server.

The former intelligence officer TheDCNF spoke with said the ICIG “discovered the anomaly pretty early in 2015.”

“When [the ICIG] did a very deep dive, they found in the actual metadata — the data which is at the header and footer of all the emails — that a copy, a ‘courtesy copy,’ was being sent to a third party and that third party was a known Chinese public company that was involved in collecting intelligence for China,” the former intelligence officer told TheDCNF.

“The [the ICIG] believe that there was some level of phishing. But once they got into the server something was embedded,” he said. “The Chinese are notorious for embedding little surprises like this.”