China will have no choice but to build its abilities in the South China Sea if the U.S. continues to “wantonly” provoke trouble in the waters, Beijing’s top newspaper warned on Monday.

The response came after a U.S. Navy warship, the USS Hopper, sailed close to a contested reef west of the Philippines on Wednesday, two days before Defense Secretary Jim Mattis unveiled a new strategy calling China and Russia the biggest threats to the U.S., not terrorism.

Mattis’ comments come at a time the Trump administration is working for cooperation with Beijing on North Korea.

“If the relevant party once more makes trouble out of nothing and causes tensions, then it will only cause China to reach this conclusion: in order to earnestly protect peace in the South China Sea, China must strengthen and speed up the building of its abilities there,” The People’s Daily said in the commentary, according to Reuters.

China claims virtually the entire South China Sea and has carried out extensive land reclamation work on many of the islands and reefs it claims, equipping some with air strips and military installations that have alarmed rival claimant countries and Western governments led by the United States.

Chinese Foreign Ministry spokesman Lu Kang said Saturday that China would take "necessary measures" to protect its sovereignty after the USS Hopper sailed within 12 nautical miles of Scarborough Shoal on Wednesday evening without China's permission.

The United States does not claim territory in the South China Sea but has declared it has a national interest in ensuring that the territorial disputes there are resolved peacefully in accordance with international law.

The U.S. Navy regularly sails through the area to assert freedom of navigation.

Lt. Cmdr. Nicole Schwegman, a spokeswoman for the U.S. Navy's Pacific Fleet, said Saturday that such operations are "not about any one country, nor are they about making political statements." Instead they aim to "demonstrate our commitment to uphold the rights, freedoms and lawful uses of the sea and airspace guaranteed to all nations under international law."

The Associated Press contributed to this report