A US underwater drone seized by the Chinese navy in the contentious South China Sea has now been returned.
The drone was handed over some 92km north-west of Subic Bay in the Philippines, officials said.
China seized the vehicle in international waters, in one of the most serious confrontations between the powers in decades.
The US said it would continue to “fly, sail, and operate in the South China Sea” where international law allows.
“After friendly consultations between the Chinese and US sides, the handover was smoothly completed at midday,” China’s defence ministry said in a statement on Tuesday.
The Pentagon described the incident as inconsistent with international law and codes of conduct between navies at sea, and added that it would continue to investigate.
A Chinese Navy ship seized the drone 92km (57 miles) north-west of Subic Bay near the Philippines in the South China Sea on Thursday.
According to the Pentagon, the drone, known as an unmanned underwater vehicle (UUV), was being used to carry out scientific research at the time it was captured.
China’s defence ministry said in a statement that the craft was retrieved and examined to maintain the safety of passing vessels.
Although an agreement on the return of the drone was eventually reached, it did not come before sharp exchanges and a formal diplomatic complaint by the US.
US President-elect Donald Trump earlier accused the Chinese of “stealing”.
“We should tell China that we don’t want the drone they stole back – let them keep it!” he tweeted.
China’s defence ministry later said that the vessel would be returned in an “appropriate manner”, calling the US response “unhelpful”.
Analysts believe this is likely to stoke US concerns about the growing military build-up by China in the South China Sea.
China has claimed territorial rights over most of the South China Sea but its claims are disputed by several nations.
China, Vietnam, the Philippines, Taiwan, Malaysia and Brunei all have competing claims.
China has backed its expansive claims with island-building and naval patrols. The US says it does not take sides in territorial disputes, but has sent military ships and planes near disputed islands, calling them “freedom of navigation” operations to ensure access to key shipping and air routes.
Both sides have accused each other of “militarising” the South China Sea.
The Philippines called the drone incident, which took place inside its exclusive economic zone, “very troubling” saying it increased the likelihood of “miscalculations that could lead to open confrontation” very near the Philippine mainland.
Relations between the US and China have been growing increasingly tense, with Mr Trump inflaming the Chinese by speaking on the phone earlier this month with the leader of Taiwan, breaking a long-standing US practice.
China has so far been restrained in its official responses to Mr Trump, choosing instead to stress the importance of Sino-US ties.
There were “friendly consultations” about the fate of a drone that was taken because China said it may have posed a threat to vessels around it.
Beijing had earlier claimed it simply treated it like something you might “find in the street”. Or is that just diplomatic gloss?
Was it instead what the Pentagon described as the return of a piece of US kit “unlawfully seized” while it was in international waters “in full compliance with international law”?
The US says it will “continue to investigate” the events surrounding the seizure. Five days is more than enough time to have a good look inside a piece of hardware that your rival may be using to track your submarines.
As the clock ticks towards the arrival of President Trump tensions are escalating, with both sides choosing different ways to send a message to the other.