For the first time in modern Swedish history, an ex-ambassador has gone on trial and faces a possible jail term.
Anna Lindstedt is accused of going beyond her remit by holding unauthorised talks with a foreign power to gain the release of a Chinese-born Swedish citizen.
Gui Minhai, a Hong Kong bookseller, was later jailed by China for "illegally providing intelligence overseas".
The prosecutor said Ms Lindstedt had put relations with China at risk.
She had acted in violation of Swedish foreign policy by arranging the negotiations, he told the court on Friday.
The former ambassador's defence lawyer told the court in Stockholm she denied the charges.
What is the ex-ambassador accused of doing?
In February 2019 Anna Lindstedt was recalled from China as ambassador after she was accused of brokering an unauthorised meeting at the Sheraton Hotel in Stockholm between Gui Minhai's daughter, Angela Gui, and two Chinese businessmen said to have connections to the Chinese Communist Party.
Before the meeting Ms Gui had been campaigning for her father's release, and then said she had been invited to the meeting by Ms Lindstedt, who told her "there were some businessmen she thought could help, and that they wanted to meet me in Stockholm".
She alleged that during a meeting over two days one of the businessmen had pressed her to accept a deal involving a "few years" in jail if she stopped publicising her father's detention.
Ms Gui also alleged that the ambassador had backed the plan, warning her that if her publicity continued, China might "punish Sweden".
What does Lindstedt say?
Anna Lindstedt has denied wrongdoing and said nothing publicly. However, she argues that she emailed the foreign ministry in Stockholm about the meeting and as ambassador had appropriate powers to act.
She also denies that the meeting with the two businessmen constituted talks with China. Prosecutors say at least one of them represented the Chinese state.
The foreign ministry says it sent a message to her to drop the case but the former ambassador says she never received it.
Twenty-one ex-ambassadors have defended Ms Lindstedt, arguing that she was well within her mandate to organise the meeting and have criticised the decision to involve Swedish police.
Who is Gui Minhai?
A Hong Kong bookseller with Swedish citizenship, he went missing while on holiday in Thailand in 2015 and later turned up on Chinese state television confessing to a 2003 drunken driving incident.
Four other Hong Kong booksellers, who were also involved in publishing racy accounts of Chinese leaders, disappeared around the same time and later appeared in custody in mainland China.
Gui Minhai was released in 2017 but then detained on a train to Beijing with Swedish diplomats and jailed last February on charges of illegally providing intelligence abroad.