(Bloomberg) -- China’s holdings of U.S. Treasuries fell for a third consecutive month in August as the Asian nation struggles to prevent the yuan from weakening.

China’s ownership of U.S. bonds, bills and notes was $1.165 trillion, down from $1.171 trillion in July, according to data released by the Treasury Department on Tuesday. Japan, which is the largest foreign owner of Treasuries after China, decreased its holdings to $1.03 trillion from $1.036 trillion a month earlier.

Beijing’s sale of Treasuries is sometimes viewed as a response to the trade war, especially after China’s ambassador to the U.S. signaled in March his country could scale back purchases of the debt to retaliate against American tariffs. President Donald Trump since July has imposed tariffs on about half of Chinese imports, with Beijing responding with duties of its own on American goods.

But China has allowed its foreign-exchange reserves to decline as part of a policy to stabilize the yuan and prevent it from weakening further. The yuan already has depreciated about 5 percent against the dollar in the past year amid signs of an economic slowdown and capital flight. Trump has accused Beijing of deliberately weakening its currency to stimulate exports.

Overall foreign holdings of U.S. Treasuries rose $35.4 billion to $6.287 trillion in August, with Brazil, Saudi Arabia and Ireland increasing their ownership.

--With assistance from Scott Lanman.

To contact the reporter on this story: Randall Woods in Washington at rwoods13@bloomberg.net

To contact the editor responsible for this story: Brendan Murray at brmurray@bloomberg.net

©2018 Bloomberg L.P.