VANCOUVER -- Canadian border guards mistakenly gave the RCMP passcodes to electronic devices belonging to Huawei Technologies executive Meng Wanzhou, a Crown prosecutor said Tuesday.

Officers with the Canada Border Services Agency questioned Meng for three hours at Vancouver's airport before the RCMP executed a provisional arrest warrant on Dec. 1, 2018.

Border officers seized Meng's cellphones, tablet and other devices and wrote down her passcodes on a piece of paper that they handed to the RCMP when she was arrested.

The border agency later realized it had made a mistake and told the RCMP the codes could not be used or shared because they'd been obtained during a CBSA examination, a Crown lawyer said.

"The fact of an error in the process is not an air of reality that the process was a sham," Diba Majzub told a British Columbia Supreme Court judge.

The Chinese tech giant's chief financial officer was arrested at the request of the United States, which is seeking her extradition on fraud charges linked to the alleged violation of sanctions against Iran.

Meng's arrest has sparked a diplomatic crisis between Canada and China. She denies any wrongdoing and her lawyers are in court seeking further documents ahead of her extradition trial in January.

Her lawyers allege that border officers, the RCMP and the Federal Bureau of Investigation conspired to conduct a "covert criminal investigation" at the airport and violate her charter rights.

It's unclear when exactly the border agency informed police that it had mistakenly provided the passcodes.

The RCMP responded that it had not used the codes but it could not return them because they had already formed part of the evidence before a judge, Majzub said.

Justice Heather Holmes questioned whether the fact that the border agency made a misstep and later tried to repair its error lent an "air of reality" to the defence's arguments.

"If we scrutinize any process ... there might be errors," Majzub insisted. "It was not a deliberate action but an error."

Following Meng's arrest, the FBI made an email request for records of Meng's travel through Vancouver's airport and for any reports detailing her examination by border officers.

Canada's border agency provided the traveller records but told the FBI that it would have to request the reports through a judicial process called a mutual legal assistance treaty.

"Two irresistible conclusions flow from this response: Firstly, no information obtained from the secondary examination was provided by the CBSA to the FBI," Mazjub said.

"And the more crucial point is this: given the FBI made a request for the information through formal channels in the days following the border examination, there is no merit to any assertion of a conspiracy with the CBSA prior to the applicant's arrival at the airport."

Meng's lawyers also argue that border officers should have immediately executed the arrest warrant rather than questioning her.

Majzub told the judge that border guards are required by law to conduct an admissibility examination on all travellers entering Canada and they aren't legally empowered to arrest people under the Extradition Act.

The Crown has provided 150 examples of cases in which border officers were involved but were not the ones to execute such warrants, he added.

He also stated that there is a legal line between a customs and immigration examination and an investigation of a criminal offence in Canada, and before that line is reached, charter rights are not engaged.

"There was never a danger of that line being crossed," Majzub said. "There was no criminal investigation in Canada. ... They're entitled to go as far as they need to determine whether she's inadmissible."

The defence has argued that border guards seized the devices and questioned Meng about Huawei's business dealings in Iran in order to further the U.S. case against her.

However, Majzub said border officers went as far as they did because they had legitimate concerns about possible criminality and national security.

"The CBSA is required to treat allegations of foreign criminality seriously. The fact of the examination is evidence the CBSA was doing its job," he said.

The border agency is legally entitled to seize electronic devices and it did not search them in this case, he added.

Meng, who is also the daughter of Huawei founder Ren Zhengfei, is free on bail and living in her multimillion-dollar house in Vancouver while she awaits her trial.

As she was leaving her home Tuesday morning, she thanked Chinese-language media in her mother tongue and noted that it was a national holiday that marks the creation of the People's Republic of China.

"For the 70th anniversary of my motherland, I wish my mother country a happy birthday, prosperity and for it to be big and strong," she said.

"Wherever we are, our hearts are forever with our motherland. Thank you everyone, thank you."

This report by The Canadian Press was first published Oct. 1, 2019.