The Chinese ambassador to the United States would not rule out his nation scaling back the purchase of US government debt if the two nations end up in a trade war.

When asked by Bloomberg Television if China is considering scaling back its purchases of US debt, ambassador Cui Tiankai responded, "We are looking at all options."

"We don't want to have a trade war with anybody," he said earlier in the interview. "We are still trying to avoid one. But if a trade war is forced on us, we have to fight back. We will take all the measures necessary."

Related: The world is on the brink of a trade war

After the Trump administration announced tariffs against China on Thursday amid allegations of intellectual property theft, there are fears that a trade war between the world's two largest economies.

China is the largest foreign US bond holder, with $1.17 trillion in holdings. But China trimmed those holdings by 1.4% in January compared to December, the latest data shows.

The US debt that China buys helps finance the rising federal government deficit. If China suddenly stopped buying bonds, the interest rates that the government pays on those bonds would soar in order to attract more investors. China's bond purchases also helps keep interest rates lower for American consumers and businesses, since many forms of borrowing, such as mortgage rates, typically move in line with bond rates.

"We believe any unilateral and protectionist moves would hurt everybody, including the United States itself," said Cui. "It would certainly hurt the daily life of American middle class people, and the American companies and the financial markets.

Related: China plans to hit US with tariffs

But most experts doubt that China would cut its bond purchases enough to move Treasury rates. If it did so, that would reduce the value of the $1 trillion in bonds it already holds. And the large trade gap between the United States and China means that China collects far more dollars for its exports than it pays for American goods and services that it purchases. It has to do something with those excess dollars, and purchasing US government debt is an efficient way to use them.

The rates on the benchmark 10-year bond was little changed Friday after Cui's remarks.