In the photo from 1992, Yang Hengjun's mouth is tilted into a barely-there hint of a smile, which hangs below smiling eyes and a serious pair of spectacles.

Key points: Australian citizen Yang Hengjun worked for China's preeminent spy service for 14 years

Australian citizen Yang Hengjun worked for China's preeminent spy service for 14 years His detention by Beijing is likely connected to his decision to turn his back on the Chinese State

His detention by Beijing is likely connected to his decision to turn his back on the Chinese State He is expected to be formally charged with espionage this month

He was supposedly working for the Ministry of Foreign Affairs in the southern province of Hainan, and the photo shows him wearing a boxy moss green police-style uniform.

There's just one small issue: The Ministry of Foreign Affairs doesn't have a uniform and the clothes Yang is wearing, according to a Beijing-based security analyst, belong to China's most powerful and feared spy agency, the Ministry of State Security (MSS).

"The MSS is a sprawling security intelligence service with wide ranging powers," said Clive Hamilton, co-author of an upcoming book about global Chinese influence operations, Hidden Hand.

"Its equivalent in Australia would be a combination of ASIO, the Australian Federal Police, plus ASIS — Australia's overseas intelligence organisation — all rolled into one, but with a lot more power and less subject to the constraints of the rule of law."

Yang Hengjun studied at UTS and is an Australian citizen. ( Supplied )

Today, the ABC can reveal that the Australian citizen did indeed work as a Chinese spy for 14 years.

However, according to friends and Australian officials Yang later definitively turned his back on the Chinese state to become a democracy activist and author.

That may be why, in January last year, he was detained in southern China, and has since been held by the Chinese Government over ill-defined espionage allegations, for more than 400 days.

"Yang Hengjun is a complicated person," said former Chinese diplomat Chen Yonglin, who defected to Australia in 2005 over growing disquiet about his role in monitoring Chinese dissidents here.

Chen said he met Yang several times in Australia: "My judgement is that he engaged in low-level intelligence work, and then slowly broke away from the system."

Yang, an Australian citizen and online democracy activist, was detained in Guangzhou in January last year and subsequently formally arrested over espionage allegations.

His wife Yuan Xiaoliang was also detained briefly at Guangzhou airport and subsequently interrogated by China's secret police.

ABC News can reveal she has been asked about her husband's connection with Western intelligence agencies and may herself face charges of endangering national security.

China has not provided any evidence to back up an assertion Yang was working for Western intelligence, and in August Australia's Foreign Minister took the unusual step of publicly stating Yang was not working for Australian intelligence agencies.

"There is no basis for any allegation Dr Yang was spying for the Australian Government," Foreign Minister Marise Payne said in August.

Yuan Xiaoliang awaits news of her husband Yang Hengjun, from their Beijing apartment. ( ABC News )

The ABC has spoken to two Australian Government officials, as well as a person close to China's Ministry of Public Security and a friend of the detained writer.

All agreed to discuss Yang's case only on condition of anonymity, given the sensitive nature of the topic.

All four sources told the ABC that Yang had worked for the MSS.

The ABC has also spoken to one of Yang's closest Australian friends, Sydney academic Professor Feng Chongyi.

Professor Feng said he had suspicions about Yang's background soon after meeting him, when the aspiring writer provided his résumé as part of an application to study under the University of Technology Sydney scholar.

"He graduated from Fudan [University's] international politics department — it's well known in China that that department trains a lot of spies," Professor Feng said.

Years later, Professor Feng was able to confirm with a person familiar with Yang's story that the writer had, in fact, served with MSS.

Do you know more? Please use this form to get in contact with the ABC Investigations team, or if you require more secure communication, please choose an option on the confidential tips page.

Smoke and mirrors

Nothing in the story of Yang — who later reinvented himself as writer of fiction — is straightforward, and much of the reporting about him has been hazy on his biographical information.

The writer has also long been considered a mysterious figure in Chinese dissident circles in Australia and around the world, with whispers that he retained connections to the Chinese Communist Party (CCP) system long after breaking with the Chinese state.

The ABC has uncovered the story of his past in order to better explain the dangerous political game now being played by Beijing, which has effectively turned Yang's case into a test of the China-Australia diplomatic relationship.

Yang Hengjun's parents visiting Shanghai in 1984 while he was studying at Fudan University. ( Supplied )

Shedding some light on his background may also help Australians understand that while Yang was at one time a Chinese spy, according to friends and those who've studied his case he has since turned on Beijing and become a dedicated advocate of western-style democracy.

According to information gathered by the ABC, Yang joined MSS in 1987 — only four years after it was created — and left in 2000, as his trust in the Chinese state waned and, according to friends, his interest in democratic systems of governance grew.

Over 14 years he worked on increasingly important assignments within MSS, although his positions appeared to be involved in analysis, rather than the more traditional work of frontline spies: suborning people with access to foreign secrets.

When Yang left MSS, he completely abandoned his connections to Chinese intelligence and turned his growing disillusionment with the Chinese system into a newfound career in Australia as a pro-democracy blogger and activist, Professor Feng told the ABC.

"In the eyes of MSS, he betrayed [the system] so he can't be a member of that organisation anymore," Professor Feng said, adding that Yang's arrest last year was likely prompted by his activism.

Professor Feng is going public about his friend's background because he wants to make clear that while Yang was once a Chinese spy, he is today an Australian citizen committed to democratic ideals and deserves the protection of the Australian Government.

"He is an innocent Australian citizen who exercises his legitimate, basic human right to enjoy the freedom of speech," Professor Feng said.

"He should never be punished [for] exercising those rights."

Professor Feng is also the safekeeper of a 2011 letter written by Yang which explains why he decided to become a democracy advocate.

"Through my articles, there are thousands or even hundreds of thousands of young people in China who are awakened … they let me see there is hope for China," Yang wrote.

Deadline for release or prosecution

Yang is only one of several citizens of western nations to be detained by China since the daughter of one of the country's most prominent businessmen, Huawei chairman Ren Zhengfei, was detained in Canada in December 2018.

Yuan Xiaoliang and Yang Hengjun have a daughter together.

Two Canadians, Michael Kovrig and Michael Spavor, were detained in China in late 2018, and await closed trials on charges of spying.

Yang was detained a month later, on 23 January 2019, and was formally arrested on spying allegations seven months later, on August 23.

Under Chinese law authorities must prosecute or release people within seven months of their arrest.

Given he was formally arrested on August 23, the deadline for his prosecution or release is today, March 23.

It is also possible that Yang's detention was a retaliation against Canberra for its anti-foreign influence laws, which were enacted a year before he was detained.

"Yang Hengjun has been locked up by Chinese secret police without access to lawyers and family visit for 14 months," Professor Feng said.

"His arbitrary detention and gross mistreatment are in total violation of international law and are absolutely unacceptable.

"There is no evidence to substantiate the charge of espionage and he should have been released long ago."

Beijing's Ministry for Foreign Affairs has repeatedly warned the Australian Government not to interfere in his case.

The ABC contacted the Chinese Ministry of Foreign Affairs in Beijing and China's embassy in Australia but did not get a response.

"Once you get into this world, it's murky — nothing is clear cut and the truth is almost impossible to know with certainty," said Professor Hamilton.

"But the fact that the Chinese authorities have nabbed Mr Yang and kept him in prison at times under extremely difficult conditions — they've interrogated him with extreme prejudice — it means they're angry with him, they want something.

"He clearly has fallen out with the MSS one way or another."

A hidden past

Baby Yang Hengjun. ( Weibo: Yang Hengjun )

Yang was born in 1965 to a poor family in a small city in central China's Hubei province.

As a child, he saw his father suffer during the Cultural Revolution of the 1960s and 1970s because of his job as a school principal, which was considered elitist.

Yang received high marks in high school and studied international politics at Shanghai's prestigious Fudan University, the alma mater of many of the Communist Party's most influential officials.

"It was an important place for the country's future leaders of diplomacy, defence and security," Yang later recalled in an autobiography.

Yang graduated in 1987 and announced he had taken a job with China's Ministry of Foreign Affairs (MFA) in Beijing.

According to the officials and friends spoken to by ABC News, that was only a cover: in reality, he had embarked upon a career with China's preeminent intelligence agency, MSS.

According to information provided to the ABC, Yang was transferred from Beijing to China's southern Hainan province in 1989 as part of his first position with MSS.

"Yang could have been assigned to … MSS's regional arm in Hainan as the then newly formed regional office was short of staff," said former Chinese diplomat Chen Yonglin.

In Yang's 2010 autobiography Home, Country, and All Under Heaven, he published a photo from 1992 — while he was supposedly working for the Ministry of Foreign Affairs — showing him in a uniform.

Yang Hengjun is pictured in a uniform of China's Ministry of State Security in 1992. ( Supplied )

Ministry of Foreign Affairs officials then and now do not wear uniforms.

Beijing-based analyst Wu Qiang confirmed to the ABC the uniform was one used briefly by the MSS.

"The MSS doesn't have a uniform now, but when the agency was formed in the middle of the 1980s they did trial a few versions, though they quickly abolished them," Dr Wu said.

"This one [in the photo] is the green-coloured uniform produced in 1992. Its epaulettes also signify it as belonging to the MSS."

The ABC has also established that the two gold arrows in combination with the light blue stitching on the collar is unique to the MSS.

Yang was transferred to Hong Kong in late 1992, as the British colony prepared for the 1997 handover to China.

Publicly, he worked for the state-owned China Travel Service in Hong Kong.

Secretly, Professor Feng said, he was gathering intelligence about Hong Kong's political transition.

"He worked at China Travel Agency as a manager, but that was a cover," Professor Feng said.

"His real responsibility was to collect information, intelligence, to help the state or the government formulate policy for the transition of … Hong Kong back to China."

Yang Hengjun's first major post was in Hong Kong. ( Supplied )

In 1997, soon after the handover, Yang was transferred to Washington DC and took a job as a senior fellow with US think tank, the Atlantic Council.

There, his assignment was to gather intelligence from US think tanks and members of Congress, according to Professor Feng.

A spokesman for The Atlantic Council said the organisation could not locate any records indicating Mr Yang was an employee, adding the majority of their "senior fellows" have been non-resident, and unpaid.

"This was 20 years ago, and there is no-one from the council who has been here even close to that time," said Alex Kisling, deputy director for media relations of the organisation.

'Fatal Weakness'

Washington was his last assignment with the MSS and the former diplomat, Chen, doesn't believe that Yang remained a spy after that.

Yang Hengjun (R) with his mentor Professor Feng Chongyi at his UTS graduation. ( Supplied )

"He has been largely out of the organisation after 1999," said Chen.

"He wandered around the world and didn't necessarily find much important information to report back to China."

In 2000, he moved himself and his family to Australia, where according to friends he severed ties with the Chinese state.

His wife, Yuan Xiaoliang, spoke the ABC from her Beijing apartment, where she remains under watch by the Chinese Government.

She said her husband's experience with democracy in Hong Kong and a desire to become a writer made him decide to leave the Chinese Government.

"He said that he had a dream and he wanted to be a writer. So, he quit his work and started writing," she said.

The ABC asked Yuan about her husband's history in the MSS, but she declined to answer.

Yuan is also the subject of an ongoing investigation relating to her husband and speaking about such sensitive matters could antagonise Beijing.

Traditionally, CCP prevents the families of intelligence officials from leaving China to ensure they do not betray the government.

It is unclear why, in this case, Beijing decided to let an employee of MSS go.

Chen Yonglin said it was not unusual for lower-ranking MSS officials to be able to leave China with their families after a cooling off period subsequent to their last operation.

"After they have spent a period of time out of the organisation, lower-ranked officials are allowed to leave with their families," Chen said.

Professor Feng told the ABC he believes Yang was able to leave because he made a deal with Beijing.

"He must have quite a solid agreement for Chinese intelligence to give him up," Professor Feng said.

"I don't know the detail about that part of [Yang's] story but I think it's universal: if you join an intelligence organisation, it's always hard to leave it. There must have been some sort of agreement."

Professor Feng also said Yang likely held a peripheral role within MSS and so it was easier for him to leave.

"Because he was not actually working openly as an MSS officer, he's always worked in the foreign affairs office, the think tanks, it's easier for him to leave," he said.

"He may not have had access to top state secrets and have those things that prevent him from leaving the organisation."

'He hopes…China will become a better place'

Once in Australia, Yang reinvented himself as a writer, authoring a trio of spy novels that were published in Hong Kong and banned in China.

Yang Hengjun in Hainan Province.

It took him three years to finish the novels. During that time, he made a living helping his sister run her China-based clothing business.

His first novel, Fatal Weakness, tells the story of a Chinese intelligence officer — who also has the surname Yang — who finds himself at the centre of a US-China "espionage war".

The fictional Yang is also detained over the accusation of endangering national security.

While his books sold modestly, it was his political blogging on Chinese social media sites that earned him true fame.

By 2008, he had become one of the most prominent and well-known among China's online democracy advocates.

Authoritative English-language magazine The Diplomat translated some of his online articles as an acknowledgement of his influence.

He blogged about a variety of democratic movements across China's sphere of influence, including Taiwanese elections and the fall of Chinese power in Hong Kong.

Yang's blogging led to an uneasy relationship with the Chinese Government — many of his blog posts were deleted by censors, but also copied and posted around the Chinese-language internet.

Married couple Yuan Xiaoliang and Yang Hengjun have been separate since Yang was arrested in January 2019. ( Supplied )

"He has a sense of responsibility and a mission. He hopes that through his words China will become a better place," said his wife Yuan.

Yuan told ABC News her husband had millions of Chinese readers including, she said, members of the Chinese bureaucracy who secretly support democratic reform.

Yang's arrest last year was also not the first time he had run afoul of the Chinese Government.

In 2011, Yang was detained for three days during a trip to China by the Ministry of Public Security over suspicions he was playing a key role in organising democracy protests that became known as the Jasmine Revolution.

It could have been worse, but Australia's then-prime minister Julia Gillard was visiting China at the time and personally asked about Yang's situation during a meeting with then-Chinese president Hu Jintao.

Keen to avoid a scandal, Beijing released Yang.

At the time Yang decided to not antagonise Beijing by revealing the detention.

Instead, he and his mentor Professor Feng, told people his absence was a "misunderstanding" and the blogger had been too sick to answer phone calls.

Professor Feng told the ABC when Yang was arrested, the secret police waited 24 hours to see if Yang's old employer, MSS, would come to his rescue, but no-one came.

Chen Yonglin says that is another indication Yang was no longer working for Chinese intelligence.

"Yang would have to report to his superior within 24 hours if he was still a spy," said Chen.

Following his 2011 arrest, Yang continued to call for democratic reform in China while living in Sydney.

'They will hold me for as long as they can'

ABC News has also seen a series of diplomatic reports by Australian consular officials who have visited Yang in jail.

They describe the physical and mental toll the year-long detention has taken on the writer, who is being held in a highly secure detention facility in Beijing.

He has had twice-daily interrogations and constant exposure to light, which had led to loss of weight and hair, paleness, memory loss, tinnitus, limping, and Yang told consular staff he thought he was "going crazy".

Yang also told the Australian diplomats that he despaired of ever being released: "They will hold me for as long as they can."

Australian authorities have also not been able to see him since December, with the coronavirus outbreak forcing the cancellation of visits in January and February.

The Australian Minister for Foreign Affairs was contacted for comment but did not respond before publication.

In April last year, Yang's wife Yuan and their daughter received permanent residency in Australia, but they remain trapped in China with no idea when or if they will be released.

"I tried to go to Australia, but I was stopped by Chinese immigration, they didn't allow me to leave, I don't know what's going on," Yuan said.

"Government officials said I was suspected of endangering national security and couldn't leave China. I confirmed it with them twice, because I couldn't believe it."

Despite increasing risks of retaliation from Beijing, Yang continued to write and be active until the day of his arrest.

"In a country without freedom of speech and where speech can result in criminal charges, authentic writing requires a little bit of courage," Yang wrote in his blog.