Since 2018, the United States has been tightening its laws to prevent its rivals from buying into its sensitive sectors – blocking investments in everything from semiconductors to telecommunications.

But the rules weren't always so strict.

In 2016, Jeff Stein, a veteran journalist covering the US intelligence community, got a tip-off: a small insurance company that specialised in selling liability insurance to FBI and CIA agents had been sold to a Chinese entity.

Someone with direct knowledge called me up and said, 'Do you know that the insurance company that insures intelligence personnel is owned by the Chinese?' he remembers. I was astonished!

In 2015, the insurer, Wright USA, had been quietly purchased by Fosun Group, a private company believed to have very close connections with China's leadership.

US concerns became immediately clear: Wright USA was privy to the personal details of many of America's top secret service agents and intelligence officials. No one in the US knew who might have access to that information now the insurer and its parent, Ironshore, were Chinese-owned.

Wright USA wasn't an isolated case.

The BBC has exclusive early access to new data that shows how Chinese state money has been flowing into wealthy countries, buying up assets in the US, Europe, the Middle East, and Australia.

In the past couple of decades, China has become the world's biggest overseas investor, giving it the potential to dominate sensitive industries, secrets, and key technologies. Beijing considers the details of its foreign spending overseas – how much money it's spending and where - to be a state secret.

But on the terms of the Wright USA sale, Stein says: There was nothing illegal about it; it was in the open, so to speak. But because everything's intertwined so closely in Beijing, you're essentially giving that [information] up to Chinese intelligence.

The Chinese government was involved in the deal: fresh data seen by the BBC reveals that four Chinese state banks had provided a $1.2bn (£912m) loan, routed through the Cayman Islands, to allow Fosun to buy Wright USA.

Stein's story ran in Newsweek magazine. And there was a swift reaction in Washington: triggering an inquiry by the branch of the US Treasury that screens investments, the Committee on Foreign Investment in the United States (CFIUS). Shortly after, the company was sold again - back to Americans. It's unclear who ordered that sale.

Fosun and Starr Wright USA, the company that now owns Wright USA, did not respond to a BBC request for comment.

High-level US intelligence sources confirm the Wright USA sale was one of the cases that led the first Trump administration to tighten its investment laws in 2018.

Very few could have understood at the time that this Chinese state-backed spending appears to have been part of a much bigger strategy carried out by Beijing to invest and buy assets on every continent.

For many years, we assumed that virtually all of China's money flows were going to developing countries, says Brad Parks, executive director of AidData. And so, it came as a great surprise to us when we realised that actually there were hundreds of billions of dollars going into places like the US, the UK, and Germany, happening right underneath our noses.

AidData is a research lab based in Virginia that specialises in tracking how governments spend their money outside their borders. It's based at William & Mary, one of America's oldest universities, and gets its funding from governments and charitable organisations around the world. For the past 12 years, AidData has had a major focus on China.

A four-year effort involving 120 researchers has led to the first known effort to tally all of China's state-backed investments around the world. The group's entire dataset is available open source although the BBC was given exclusive advance access.

AidData's key discovery: since 2000, Beijing has spent $2.1 trillion outside its borders, with a roughly equal split between developing and wealthy countries.

China has a kind of financial system that the world has never seen, says Victor Shih, director of the 21st Century China Centre at University of California San Diego. China has the largest banking system in the world – larger than the US, Europe, and Japan put together, he adds.

That size, along with the amount of control Beijing exerts over state banks, gives it unique capabilities.

Some of the investments in wealthy economies appear to have been made to generate a healthy return. Others fall in line with Beijing's strategic objectives, set out in a major government initiative called Made in China 2025.

In it the Chinese authorities outlined a clear plan to dominate ten cutting-edge industries, like robotics, electric vehicles, and semiconductors by this year.

Global alarm at the plan led China to drop public mention of it, but Victor Shih says it stayed very much alive as a guiding strategy.

At a key meeting of the Communist Party last month, China's leaders set the goal of accelerating high-level scientific and technological self-reliance and self-improvement until 2030.

AidData's new database highlights state-backed spending overseas that matches the ten sectors targeted in 2015. The BBC's earlier reporting detailed how the Chinese government bankrolled the purchase of a UK semiconductor company.

The United States, the UK, and many other major economies have tightened their investment screening mechanisms after each country appears to have been caught off-guard by deals like the sale of the insurer, Wright USA.

AidData's Brad Parks says wealthy governments didn't realise at first that Chinese investments in each country were part of Beijing's larger strategy.

However, it must be underlined that such investments and purchases are legal, even if they are sometimes obscured within shell companies or routed through offshore accounts.

China's spending patterns are changing, the AidData database shows, with Beijing's state money flowing to countries that have decided to welcome Chinese investment.

In the Netherlands, there's been debate around Nexperia, a troubled Chinese-owned semiconductor company.

Xiaoxue Martin, a research fellow at the Clingendael Institute in The Hague, says many in the Netherlands were surprised at how the government handled the case.

If China is so far ahead of its rivals in its plans to buy into sensitive sectors, does that mean the race to dominate these arenas is already over?

No! There are many Chinese companies that are still trying to make these types of acquisitions. The difference is, now they're facing higher levels of scrutiny to vet these inbound sources of foreign capital.

So China makes its move. China is not the follower anymore; it is the leader. It is the pace setter. But I anticipate that many G7 countries are going to move from the back foot to the front foot.

They're going to move from defence to offence.