Meng Wanzhou (C), leaves British Columbia Supreme Court
After years of diplomatic tensions, a Canadian technology executive from China was held in Canada under US fraud charges. She has now been released by prosecutors.
At the request of the US, Meng Wanzhou was taken into custody as chief financial officer at Huawei.
The US Department of Justice declined to extradite her on Friday.
China was furious and the case strained relations with Canada and the United States.
This led to accusations that China detained Canadian citizens as a retaliation. China refuted these allegations.
"My life was turned upside down." After being released from Canadian detention, Ms Meng said that it was a difficult time in her life.
She continued, "Every cloud has its silver lining."
According to AFP news agency, she boarded a flight with Air China shortly after that bound for Shenzhen.
Meng Wanzhou was believed to have left Vancouver International Airport aboard this Air China flight bound to Shenzhen.
The details of a possible deal to release Ms Meng have been the subject intense negotiations between US diplomats and Chinese diplomats.
The US claimed that Ms Meng lied to HSBC about Huawei's relationship and Skycom. This put the bank at risk of violating US sanctions.
The US Department of Justice (DOJ), announced Friday that it had reached a deferred prosecutorial agreement.
The DOJ will therefore not prosecute Ms Meng before December 2022. The case would be dismissed if she met all conditions.
She was released on the recommendation of the Americans.
Later, Canadian prosecutors informed a Vancouver court that they had stopped trying to extradite her the US and that she should be released from detention.
Continue the story
For nearly three years, she had been living under house arrest at her Vancouver multimillion-dollar home.
Before the court appearance, Ms Meng entered the building with Chinese consular officials.
The judge ordered her to go.
Ms Meng was required to sign a "statement" of facts admitting she made false statements to HSBC as part of the agreement.
According to the DOJ, Ms. Meng "has taken responsibility for her main role in a scheme to defraud global financial institutions".
Also, the DOJ stated that it was continuing preparations for a trial against Huawei.
Analysis box by Gordon Corera Security correspondent
There have been many behind-the scenes contacts for months, with Huawei executives being sent to Washington to resolve a case that has fueled international tension.
Huawei's boss believes the issue is personal. His daughter was held. But for China, it has become a major source of anger. It has also poisoned relations between China, Canada and the United States, as the former believes that two of its citizens, Michael Kovrig, and Michael Spavor were used in negotiations.
The ability to decrease tensions can be achieved through a deal. There will be questions about what the US gains from it. What kind of connection might there be between the events in North America, and the status of two Michaels in China
Ms Meng, the elder daughter Ren Zhengfei (billionaire), is founder of Huawei in 1987. It is the largest manufacturer of telecom equipment in the world.
He was a nine-year veteran of the Chinese army, from 1983 to 1983. He is now a member the Chinese Communist Party.
Huawei was accused by the Chinese authorities of using its equipment to spy on them. Huawei denies these allegations.
The US placed Huawei on an export blacklist and imposed sanctions in 2019. This cut off Huawei from key technologies.
Australia, Japan, Sweden, Australia, and the UK have all banned Huawei. Other countries, such as France and India, have taken measures to prevent a complete ban.
Two Canadian citizens were detained by China on suspicion of spying, Michael Spavor, and Michael Kovrig just a few days after Ms Meng had been arrested.
China has been accused by critics of using them as bargaining chips. This is part of what is called "hostage diplomacy". China refutes this accusation.
A Chinese court sentenced Michael Spavor, a Chinese businessman, to 11 years imprisonment for espionage.
Canada condemned the sentence and said that the trial did not meet international standards.
Experts say that while Ms Meng's deal with the US could pave the way to the release of the two Canadians, tensions in China-Canada relations won't quickly disappear.
Since Meng's arrest, the bilateral relationship has fallen to new lows.
Huawei remains under investigation by the US and is on a trade blacklist. Others Chinese tech companies operating in the US such as TikTok are also under scrutiny.
Rui Ma, a Chinese analyst in the tech sector, told BBC that many Chinese companies believed that Ms Meng's agreement with the US would not lead to further deterioration of US relations with China. "But no one is taking this to mean that there has been a reversal of tensions."