SHANGHAI (Reuters) - A U.S. Navy destroyer this week sailed near the Scarborough Shoal, a disputed lagoon claimed by China in the South China Sea, U.S. officials said on Saturday, and Beijing vowed to take “necessary measures” to protect what it said was its sovereignty.

China’s foreign ministry said USS Hopper missile destroyer came within 12 nautical miles off Huangyan island, better known as the Scarborough Shoal and subject to a rival claim by the Philippines, a historic ally of the United States.

It was the latest U.S. naval operation challenging extensive Chinese claims in the South China Sea and came even as U.S. President Donald Trump’s administration seeks Chinese cooperation in dealing with North Korea’s missile and nuclear programs.

Two U.S. officials confirmed that the USS Hopper had sailed within 12 nautical miles of Scarborough Shoal, a rocky outcrop and prime fishing spot due to its bountiful catches and calm waters.

With a permanent presence of large coastguard vessels, China blockaded the Scarborough Shoal for more than four years but ended that in October 2016 at the request of Philippine President Rodrigo Duterte, who said Filipino fishermen were suffering.

The U.S. officials, who spoke on condition of anonymity, said the patrol was in line 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 an internationally recognized territorial limit.

Though located within the Philippines’ 200 nautical mile Exclusive Economic Zone, an international tribunal in 2016 ruled that the Scarborough Shoal is a traditional fishing ground that no one country has sole rights to exploit.

The U.S. military says it carries out “freedom of navigation” operations throughout the world, including in areas claimed by allies, and that they are separate from political considerations.

The Pentagon did not directly comment on the latest patrol but said such operations are routine.

“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. China criticized the strategy, saying Beijing sought “global partnership, not global dominance.”

Chinese foreign ministry spokesman Lu Kang said the USS Hopper violated China’s sovereignty and security interests and threatened the safety of Chinese vessels and personnel.

Lu said the Chinese navy ordered the vessel to withdraw after determining its identity.

The United States has criticized China for constructing islands and military installations in the South China Sea, saying they could be used to restrict free movement in a critical global trade route.

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

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.

The Philippines has sparred with China for decades over what it says is aggressive conduct at the Scarborough Shoal. But in Duterte, China has found an unlikely new ally who prefers to avoid confrontation.

“We do not wish to be part of a U.S.-China intramural. The United States can take care of its own interest,” Duterte’s spokesman, Harry Roque, said on Sunday.

He said the Manila’s claim over the Scarborough Shoal “is recognized under our constitutional law and international law”.

Greg Poling, a South China Sea expert at Washington’s Center for Strategic and International Studies think tank, said the Pentagon appeared determined to keep up regular freedom of navigation patrols in the sea, with one every six weeks or so, in spite of Chinese objections.

“The last made public was in October, but we should expect that there was at least one other in the interim,” he said. “The only time word is getting out these days is if Beijing makes an issue of it.”