China on Tuesday returned a U.S. naval drone seized in the South China Sea last week, a peaceful resolution to a military standoff that threatened to inflame maritime tensions ahead of President-elect Donald Trump’s inauguration.

The Chinese Defense Ministry said in a statement that the drone was transferred to the United States after “friendly negotiation.” In a separate statement, the Pentagon confirmed the drone’s return but offered a less friendly-sounding account.

The incident was “inconsistent with both international law and standards of professionalism for conduct between navies at sea,” the Pentagon statement said.

The United States has “called on Chinese authorities to comply with their obligations under international law and to refrain from further efforts to impede lawful U.S. activities,” the statement said.

The standoff started last week after a Chinese submarine rescue ship close to the USNS Bowditch, an oceanographic survey vessel operating northwest of Subic Bay in the Philippines, took possession of the U.S. drone. The U.S. side said that it asked the ship to return the drone and that the Chinese side refused.

(McKenna Ewen,Whitney Shefte,Dalton Bennett/The Washington Post)

The drone was seized about 50 nautical miles northwest of Subic Bay, a Philippine port that was once a U.S. military base and still plays host to visiting U.S. troops and ships. The area is not far from Scarborough Shoal, a U-shaped cluster of reefs and rocks that has been a flash point in China’s relations with the Philippines and the United States.

Though Washington says it has no position on rival sovereignty claims in the South China Sea, it has been critical of China’s posture, particularly its island-building in contested waters. The U.S. Navy conducts patrols — officially called “freedom of navigation operations” — in the area.

China sees the presence of U.S. ships as interference and has repeatedly said it is the United States, not China, that wants to militarize the South China Sea.

Unsurprisingly, Beijing and Washington offered conflicting accounts of the drone flap. The U.S. side said its vessel, known as a “glider,” collects unclassified data on water temperature, salinity and other factors that may affect navigation.

In Washington, its seizure was seen as a provocation. Sen. John McCain (R-Ariz.), chairman of the Senate Armed Services Committee, on Friday called the incident a “flagrant violation” of the law of the sea.

China, meanwhile, played down the incident. Yang Yujun, a spokesman for the Defense Ministry, said in a statement that the Chinese ship took the U.S. drone “to prevent the device from harming the navigation safety and personnel safety of the ship.”

“The U.S. military has frequently dispatched naval vessels to carry out reconnaissance and military measurements in China’s water. China resolutely opposes this and urges the U.S. side to stop such activities,” he said.

As the standoff dragged on, Trump weighed in, posting a message on Twitter that said: “China steals United States Navy research drone in international waters — rips it out of water and takes it to China in unprecedented act.”

When the Chinese eventually agreed to return the vessel, Trump reacted on Twitter again. “We should tell China that we don’t want the drone they stole back.- let them keep it!” he wrote.

Asked about Trump’s comment, Hua Chunying, a spokeswoman for China’s Foreign Ministry, on Monday questioned his wording.  “We don’t like the word ‘steal’ — the word is absolutely inaccurate,” she said.

“This is just like you found a thing on the street, and you have to take a look and investigate it to see if the thing belongs to one who wants it back.”

Han Xudong, a military expert in Beijing, said the United States had “made a mountain out of a molehill” by hyping up the seizure. “It’s a simple matter that could have been easily resolved via diplomatic or military channels,” he said, adding that China’s handling of the event was by the book. 

“It’s not appropriate for Trump to comment on this,” Han said.

But Han said the outcome showed that, tweets aside, Washington and Beijing wanted a peaceful resolution: “The U.S. turn from high key to low key helped in solving the problem smoothly.” 

Trump’s response to the drone incident will no doubt compound Chinese concerns about the president-elect’s Asia policy. After winning the presidential election, Trump surprised Beijing by taking a phone call from Taiwan’s leader, Tsai Ing-wen, a move that broke with decades of diplomatic practice.

Trump’s Twitter comments on Taiwan and the drone have made him a subject of derision and ridicule in the Communist Party-controlled press.

“Trump is not behaving as a president who will become master of the White House in a month,” the Global Times wrote in an editorial. “He bears no sense of how to lead a superpower.”

Luna Lin in Beijing contributed to this report.