A diplomatic row between China and the West appears to be ending, after the release of two Canadians held in China and a Chinese tech executive in Canada.
Huawei executive Meng Wanzhou, arrested on a US warrant in 2018, left Canada on Friday in a deal with US prosecutors.
Hours later it was announced that Michael Spavor and Michael Kovrig, accused of espionage by China in the same year, were flying home to Canada.
Beijing denies detaining the Canadians in retaliation for Ms Meng's arrest.
But critics have accused China of using them as political bargaining chips.
The two men had maintained their innocence throughout. At a news conference, Canadian Prime Minister Justin Trudeau said they had been through "an unbelievably difficult ordeal".
"It is good news for all of us that they are on their way home to their families," he added. "For the past 1,000 days, they have shown strength, perseverance, resilience and grace."
The prime minister said both men will arrive in Canada early on Saturday. They are being accompanied by Dominic Barton, Canada's ambassador to China.
Before her release, Ms Meng - the daughter of Ren Zhengfei, the billionaire founder of Chinese telecoms giant Huawei - admitted misleading US investigators about Huawei's business dealings in Iran.
She spent three years under house arrest in Canada while fighting extradition to the United States.
Speaking after the executive's release, a Chinese Foreign Ministry spokeswoman said the charges against Ms Meng were fabricated.
State media quoted Hua Chunying as saying the case was "act of political persecution against Chinese citizens".
Deal or domino effect?
Meng Wanzhou is on her way back here full of praise and thanks for what she called "the motherland" and China's ruling Communist Party, a party that her employer Huawei has gone to extraordinary lengths to try to distance itself from.
She admitted misleading US investigators about her involvement in payments over business in Iran.
As soon as her freedom was assured, China released the two Canadians it's held since days after her arrest.
Whether it's a deal or a domino effect is not clear, but only weeks ago the Chinese government insisted yet again the two cases were not linked. "Different in nature," it said.
The decision to release and send home Michael Spavor and Michael Kovrig almost instantly after Meng Wanzhou was free to go appears to show that pretence has been abandoned.
Mr Kovrig is a former diplomat employed by International Crisis Group, a Brussels-based think tank.
Mr Spavor is a founding member of an organisation that facilitates international business and cultural ties with North Korea.
In August this year a Chinese court sentenced Mr Spavor to 11 years in prison for espionage. There had been no decision in Mr Kovrig's case.
In a statement, US Secretary of State Antony Blinken said his country was "pleased" by the Chinese move, but added that the men had suffered "more than two-and-a-half years of arbitrary detention".
Earlier on Friday, a Canadian judge ordered the release of Ms Meng, Huawei's chief financial officer, after she reached a deal with US prosecutors over fraud charges against her.
"Over the past three years my life has been turned upside down," she told reporters outside the Vancouver courthouse.
"Every cloud has a silver lining," she continued. "I will never forget all the good wishes I received from people around the world."
Later in a post on social media she thanked the Communist Party, the Chinese government and the "motherland".
Meanwhile Huawei released a statement, in which it said it looked forward to seeing Ms Meng reunited with her family and saying it would continue to defend itself in court.
Before her arrest, US prosecutors accused Ms Meng of fraud, alleging that she misled banks into processing transactions for Huawei that broke US sanctions against Iran.
As part of a deferred prosecution agreement, Ms Meng admitted to misleading HSBC about Huawei's relationship with Skycom, a Hong-Kong based company that operated in Iran.
The US justice department said in a statement that it was continuing to prepare for trial against Huawei, which is still on a trade blacklist.
Ms Meng is the elder daughter of billionaire Ren Zhengfei, who set up Huawei in 1987. He also served in the Chinese army for nine years, until 1983, and is a member of the Chinese Communist Party.
Huawei itself is now the largest telecom equipment maker in the world. It has faced accusations that 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.