The Trump administration’s decision to close China’s consulate in Houston on Wednesday came after years of FBI intelligence-gathering showed it was a hot spot of Chinese spying in the U.S., and President Donald Trump has been kept informed about its activities since soon after he took office, U.S. officials told NBC News.

Multiple U.S. officials said that the Houston consulate has long been used by the Chinese government to steal valuable medical research and that it was involved in attempts to infiltrate the oil and natural gas industries. The president has been well briefed about the concerns, they said.

Current and former U.S. law enforcement officials said that the consulate is well fortified and hardened to prevent U.S. surveillance and that it was a high-tech communications hub to coordinate and execute spying operations.

The U.S. government ordered China to “cease all operations and events” at the consulate Wednesday.

Sen. Mark Warner of Virginia, the ranking Democrat on the Intelligence Committee, told NBC News’ Katy Tur that he wouldn’t discuss the specific intelligence behind Wednesday’s closure.

“But I can tell you for the last two years,” he said, “I and other members of the intel committee have been holding classified briefings with business leaders and academic leaders about the concerted efforts of the Chinese Communist Party to steal our intellectual property, to steal it from companies, to steal it from universities, to be on better guard.”

Warner suggested that Wednesday’s action was driven by the FBI and its intelligence. Current and former federal law enforcement officials applauded the move, saying it was a strong message that was overdue to be delivered to the Chinese government.

On Tuesday night, hours before the news of the consulate’s closure was announced, neighbors noticed and recorded small fires in bins in the consulate’s internal courtyard. The Houston Fire Department, which responded, said in a statement: “Fire crews were denied access by building occupants. … According to international agreement, access to the property can only be obtained with consent.”

Almost exactly three years ago, the fire department was allowed in to put out a fire and was praised in a news release by Chinese officials.

As NBC News has previously reported, the Houston consulate — along with China’s other consulates and its embassy in Washington — has also been involved in “mask diplomacy” during the COVID-19 pandemic. With China facing criticism over the coronavirus pandemic, its diplomatic missions in the U.S. were on a charm offensive, organizing donations of medical supplies and food to communities large and small.

IMAGE: The MD Anderson Cancer Center in Houston (Pat Sullivan / AP file)
IMAGE: The MD Anderson Cancer Center in Houston (Pat Sullivan / AP file)

The displays of generosity were routinely accompanied by ribbon-cutting events with local officials, covered widely by Chinese state-run media outlets in multiple languages and showcased by the consulates and China’s government on social media.

Current and former law enforcement officials say the focus by the consulate and the Chinese government on the oil and natural gas businesses — which are entrenched in Houston — was tied to efforts to understand why the companies were so skilled at finding petroleum fields and drilling locations across the globe.

The FBI in Houston has also been investigating Chinese nationals’ efforts to funnel advanced research from Houston’s University of Texas MD Anderson Cancer Center back to China.

The FBI was focused in part on Keping Xie, a gastroenterology professor at the medical facility and a member of the Chinese government science recruiting program called Thousand Talents, which has been linked to espionage efforts in the U.S., according to court filings and multiple U.S. officials briefed on the matter.

Xie was arrested on an unrelated charge in 2018. The charge has since been dropped, and his attorney said at the time that Xie had no knowledge of an espionage-related investigation.

Rep. Michael McCaul, R-Texas, chair of the Homeland Security Committee, said he had been briefed on the investigation. “This is a systematic effort by the Chinese government to get into our medical facilities, our research development facilities, academics as well,” McCaul said.

In April 2019, three of five scientists whom federal authorities identified as having been involved in efforts to steal U.S. research on behalf of China were also ousted by at MD Anderson. A fourth scientist resigned before the investigation ended, and the fifth was disciplined by the center.

MD Anderson moved to fire the scientists, whose names weren’t released, after the National Institutes of Health contacted at least 55 medical research institutions to report the names of researchers suspected of sharing federally funded research with China or other foreign governments, the NIH said.

“When NIH notified MD Anderson of concerns with specific individuals within its institution, the university took immediate steps to remediate the problem,” the NIH said in a statement.

An NBC News review of heavily redacted MD Anderson investigation reports shows that they include detailed payment information from Chinese universities and diagrams documenting how the Thousand Talents program participates in a quid-pro-quo scheme that compensates doctors for intellectual property.

One report said the investigator found “compelling evidence” that an MD Anderson doctor also held a compensated position at a Chinese university that paid a monthly subsidy of 30,000 renminbi, or $4,322.

The reports showed that MD Anderson, after gaining access to some of the researchers’ email accounts, discovered documents that showed signed consulting agreements with Chinese entities.

Download the NBC News app for breaking news and politics

Shortly before Xie was charged in August 2018, the FBI’s Houston field office conducted an unprecedented public briefing with leaders of Houston’s medical, science and academic institutions.

In announcing the briefing, the bureau said, “The FBI works closely with private partners and government agencies to ensure that federally funded research grants are guarded and protected against unscrupulous overseas enemies.” The news release didn’t cite a specific case.

At the briefing, Dr. Peter Pisters, MD Anderson’s president, said, “We have an obligation to the people of Texas — and to all people facing a cancer diagnosis — to do everything possible to protect our resources and to safely and securely advance our mission to end cancer.”

An unclassified 2018 FBI memo obtained by NBC News says, “Chinese Talent Programs pose a serious threat to U.S. businesses and universities through economic espionage and theft of IP,” or intellectual property.