A Chinese technology executive held in Canada on US fraud charges has left the country after a deal with prosecutors, following years of diplomatic tensions over her fate.
Meng Wanzhou, chief financial officer of Huawei, was detained on fraud charges in December 2018 at the request of the US.
On Friday, the US Department of Justice dropped an extradition request for her.
The case infuriated China and strained relations with the US and Canada.
It also prompted accusations that China had detained Canadian citizens in retaliation, which China denied.
"My life has been turned upside down. It was a disruptive time for me," Ms Meng told reporters after being freed from Canadian detention.
"Every cloud has a silver lining," she continued, adding: "I will never forget all the good wishes I received from people around the world."
Shortly afterwards she boarded an Air China flight bound for the Chinese city of Shenzhen, AFP news agency reports.
Details of a possible deal for Ms Meng's release have been the subject of intense negotiations between US and Chinese diplomats.
The US alleged Ms Meng misled the bank HSBC over the true nature of Huawei's relationship with a company called Skycom, putting the bank at risk of violating US sanctions against Iran.
On Friday the US Department of Justice (DOJ) said it had reached a deferred prosecution agreement.
This means the DOJ would hold off from prosecuting Ms Meng until December 2022. If she complied with conditions set by court, the case would eventually be dropped.
The deal, which recommended she be released, allowed her to formally deny guilt for key charges while also acknowledging the allegations laid out by the Americans.
Later on Friday, Canadian prosecutors told a court in Vancouver that they had withdrawn efforts to extradite her to the US and that she should be discharged from detention.
She had been under house arrest in her multimillion-dollar Vancouver home for nearly three years.
Ahead of the court appearance, Ms Meng was seen entering the building accompanied by Chinese consular officials.
The judge subsequently ordered that she go free.
As part of the deal, Ms Meng agreed to a "statement of facts" admitting that she knowingly made false statements to HSBC.
The DOJ said Ms Meng had "taken responsibility for her principal role in perpetrating a scheme to defraud a global financial institution".
The DOJ also said said it was continuing to prepare for trial against Huawei.
Ms Meng is the elder daughter of billionaire Ren Zhengfei, who set up Huawei in 1987. The company is now the largest telecom equipment maker in the world.
He served in the Chinese army for nine years, until 1983, and is also a member of the Chinese Communist Party.
Huawei has faced accusations that the Chinese authorities could use its equipment for espionage - allegations it denies.
In 2019, the US imposed sanctions on Huawei and placed it on an export blacklist, cutting it off from key technologies.
The UK, Sweden, Australia and Japan have also banned Huawei, while other countries including France and India have adopted measures stopping short of an outright ban.
A few days after Ms Meng was arrested, China detained two Canadian citizens, Michael Spavor and Michael Kovrig, on suspicion of spying.
Critics have accused China of treating them as political bargaining chips, held as part of what is known as "hostage diplomacy". China denies this.
Last month, a Chinese court convicted Michael Spavor, a businessman, of espionage and sentenced him to 11 years in prison.
Canada condemned the sentence, saying his trial did not satisfy even the minimum standards required by international law.
Ms Meng's agreement with the US may pave the way for the two Canadians' release, but tensions in China-Canada relations will not quickly dissipate, experts say.
The bilateral relationship has plunged to historic lows since Meng's arrest.
The US charges against Huawei remain, and the company is still on a trade blacklist. Other Chinese tech companies with operations in the US, such as social media company TikTok, are also facing scrutiny.
Chinese tech sector analyst Rui Ma told the BBC that many Chinese companies were hopeful that Ms Meng's deal with the US might mean no further deterioration of US-China relations, "but no one is taking it to mean that there is a reversal in tensions".
BDST: 1228 HRS, SEP 25, 2021