Defence ministry in Beijing says it handed the drone back after “friendly consultations” with American counterparts.

China has returned an underwater drone seized from the United States in the South China Sea after the incident sparked a dispute between the global superpowers.

The handover of the small unmanned vehicle to the US was “completed smoothly” after “friendly consultations” between both sides, China’s defence ministry said in a short statement on its website on Tuesday.

The “naval glider” was used to test water salinity and temperatures to help in the mapping of underwater channels, a US defence official had said, adding “it was taken” by China in international waters off Subic Bay last week.

The Chinese navy vessel that seized the drone returned it near the location where it had been taken, US Pentagon press secretary Peter Cook said in a statement issued late Monday.

READ MORE: China agrees to return seized US underwater drone

China said it snatched the equipment because it posed a safety hazard to other vessels. It also said it “strongly opposed” US reconnaissance in the South China Sea and asked Washington to stop surveillance activities.

US president-elect Donald Trump also waded into the dispute. On Sunday, after Beijing and Washington announced it would be returned, Trump tweeted: “We should tell China that we don’t want the drone they stole back – let them keep it!”

The US military has conducted several “freedom of navigation” operations in the South China Sea, in which ships and planes have passed close to the sites Beijing claims.

Such missions have drawn howls of fury from China, which accuses Washington of provocation and increasing the risk of a military mishap.

The vessel’s seizure comes amid rising tensions in the South China Sea, where China has moved to fortify its claims to the region by building tiny reefs into artificial islands. New satellite imagery made public by a US-based think-tank last week showed that China installed what appeared to be large anti-aircraft guns and close-in weapons systems on seven islets in the Spratly Islands chain.