Sweden’s former ambassador to Beijing is to go on trial for overstepping her duties by trying to negotiate the release of a Chinese-Swedish dissident held in China.

Anna Lindstedt is accused of brokering an unauthorised meeting to try to get Gui Minhai freed, prosecutors said.

Lindstedt, who is working as a foreign ministry official without an international posting, could face up to two years in prison if convicted.

The deputy chief prosecutor, Hans Ihrman, said ambassadors had “a far-reaching mandate to represent Sweden”. Nevertheless, he said, even ambassadors had to follow the guidelines set down by the foreign ministry and the government.

“In this specific consular matter she has exceeded her mandate and has therefore rendered herself criminally liable,” Ihrman said.

He said Lindstedt had been charged with arbitrariness during negotiations with a foreign power, a first in modern times.

Relations between Sweden and China have been strained for several years over Gui’s detention.

Gui, a Chinese-born Swedish citizen known for publishing gossipy titles about Chinese political leaders from a Hong Kong bookshop, disappeared from a holiday home in Thailand in 2015.

Several months later he appeared on Chinese state television confessing to a fatal drink-driving accident from more than a decade earlier, and he went on to serve two years in prison. Three months after his release in October 2017, he was arrested again, this time on a train to Beijing while travelling with Swedish diplomats.

His supporters and family have claimed his detention is part of a campaign of political repression orchestrated by Chinese authorities.

According to Swedish prosecutors, Lindstedt organised a meeting in January between Gui’s daughter and businessmen with contacts to the Chinese state. The Swedish authorities opened their investigation the following month.

Angela Gui, who has been campaigning for her father’s release, wrote in a Medium post in February that Lindstedt had invited her to Stockholm in January.

During discussions in the lounges of a hotel in the Swedish capital, in the presence of Lindstedt, she was introduced to Chinese businessmen who claimed they could help secure her father’s release. In exchange, Angela Gui said, she was told to “stop all media engagement”.

The Chinese embassy in Stockholm has said Beijing “has never authorised and will not authorise anyone to engage with Gui Minhai’s daughter”.

Last month Sweden’s culture minister, Amanda Lind, defied a Chinese threat of “counter-measures” by presenting a Swedish rights prize awarded to Gui Minhai.

• This article was amended on 11 December 2019 because if convicted, Anna Lindstedt could face up to two years in prison, not up to 10 years as an earlier version said.