A U.S. Navy destroyer sailed near a disputed territory claimed by China in the South China Sea earlier in the week, U.S. officials said on Saturday, as China’s foreign ministry said it would take “necessary measures” to ensure protection of its sovereignty.

The incident occurred as U.S. President Donald Trump’s administration seeks Chinese cooperation in dealing with North Korea’s missile and nuclear programs.

On Wednesday evening, the USS Hopper missile destroyer came within 12 nautical miles of Huangyan Island in the South China Sea, China’s foreign ministry said on its website on Saturday.

Huangyan Island, also known as the Scarborough Shoal, is a disputed territory claimed by the Philippines as well as China.

Two U.S. officials, speaking on the condition of anonymity, said the USS Hopper had sailed within 12 nautical miles of Scarborough Shoal earlier this week.

The officials said the patrol took place in accordance with international law and was an “innocent passage,” in which a warship effectively recognizes a territorial sea by crossing it quickly, without stopping.

Twelve nautical miles is the territorial limit recognized internationally.

The U.S. military has a longstanding position that such operations are carried out throughout the world, including in areas claimed by allies, and that they are separate from political considerations.

In a statement, the Pentagon did not directly comment on the patrol but said the United States routinely carries out “freedom of navigation” operations, a summary of which would be released in an annual report.

“All operations are conducted in accordance with international law and demonstrate that the United States will fly, sail, and operate wherever international law allows,” Pentagon spokesman Lieutenant Colonel Christopher Logan said.

The U.S. military put countering China and Russia at the center of a new national defense strategy unveiled on Friday.

Chinese foreign ministry spokesman Lu Kang said the ship violated China’s sovereignty and security interests and threatened the safety of the nation’s vessels and personnel in the vicinity.

China’s navy ordered the vessel to withdraw after determining its identity, Lu was quoted as saying.

The United States has criticized China for constructing islands and military installations in the region, saying they could be used to restrict free nautical movement. U.S. vessels have conducted a series of freedom of navigation patrols in the region.

China “firmly opposes” efforts to use freedom of navigation as an excuse to hurt its sovereignty and urges the United States to “correct its mistakes,” Lu said.

In a separate statement on Saturday, China’s defense ministry said the repeated dispatch of U.S. warships to the region was “undermining regional peace and stability” and hurting bilateral relations.

Fact Check: We strive for accuracy and fairness. If you discover something that does not look right here, contact us at Politicoscope. Do you have a story for publication? Send it now for free publication here on Politicoscope.