Canadian diplomats were denied entry to the trial of a former colleague on espionage charges in China, as more than two dozen western countries expressed solidarity with Ottawa in its stand-off with Beijing.

Representatives from the US, the UK, Australia, New Zealand and several EU governments gathered outside a Beijing courthouse where Michael Kovrig, a former Canadian diplomat and an adviser for International Crisis Group, a non-governmental organisation, stood trial on Monday.

Kovrig and Michael Spavor, a Canadian businessman who organised trips to North Korea, have been held for more than two years in apparent retaliation for the arrest of Huawei executive Meng Wanzhou in Vancouver.

Canadian diplomats were denied entry to Kovrig’s trial because the case touched on issues of national security, echoing China’s position at the trial of Spavor on Friday in the northeastern city of Dandong.

“We are very troubled by the lack of access and the lack of transparency in the legal process,” Jim Nickel, deputy head of mission at the Canadian Embassy in Beijing, told reporters.

Justin Trudeau, Canada’s prime minister, has accused China of employing “coercive diplomacy” in the cases and labelled the lack of transparency over the trials “completely unacceptable”.

“China needs to understand that it is not just about two Canadians. It is about respect for the rule of law and relationships with a broad range of western countries,” he said on Friday.

The accusations of spying against Kovrig and Spavor have been at the centre of a dispute between Ottawa and Beijing that began with the December 2018 arrest of Meng, Huawei’s chief financial officer and the daughter of Ren Zhengfei, the telecom company’s founder and chief executive.

She was detained in Vancouver following a US extradition request over charges of alleged fraud and attempts to evade Washington’s Iran sanctions. She has denied the allegations.

China has maintained that Kovrig and Spavor have been held in accordance with Chinese law. Ottawa has rejected this, describing the detentions as “arbitrary” and “hostage diplomacy”.

Meng was granted bail shortly after her arrest and has been living in her multimillion-dollar Vancouver home. She is able to move around the city with only light electronic surveillance as she waits for the conclusion of the lengthy extradition process.

Kovrig and Spavor have been held in separate detention centres with limited consular access. Former detainees at similar facilities have described crammed cells shared with one or more people where lights are kept on at all hours, and strictly rationed time for sleep, exercise and reading.