For the past month, I have worked 16 hours a day, without pay, on a story that is likely to be widely denounced. It is a story that has already cost me a job I loved with Reuters, after a 17-year career. Once it is published, I will be unable to return to one of my favourite countries for many years. There is a risk – small, but real – that I will face international legal action. And several people who I consider friends will be dismayed, and probably never talk to me again.

The obvious question is: why?

The answer is that – incredibly, a decade into the 21st century – this is the price that has to be paid for trying to tell the truth about an apparently modern and open country: Thailand.

Thailand claims to be a democracy, and it is holding general elections on 3 July. It claims to be a constitutional monarchy, where the widely beloved 83-year-old King Bhumibol has no political role but provides moral guidance.

There is no doubting the affection and respect that Thais have for their king. But Thailand's tragedy is that throughout its modern history, generals and courtiers have sabotaged Thai democracy while claiming to be acting in the name of the palace.

Thailand is sliding backwards into authoritarianism and repression. And one stark indication of this is that just saying it is illegal.

Thailand has the world's harshest lèse majesté law. Any insult to Bhumibol, Queen Sirikit or their son Crown Prince Vajiralongkorn, is punishable by three to 15 years in jail. Use of the law has surged, particularly since a coup in 2006. Respected academics and journalists are among those facing prison. One Thai-British professor, Giles Ungpakorn, is living in exile in London after fleeing Thailand following accusations he defamed the palace.

I arrived in Thailand in 2000, as Reuters' deputy bureau chief. I quickly fell in love with the luminous beauty of Thai culture and the warmth and joie de vivre of the people. It does not appear like a nation in the grip of repression, but things are not as they seem. The official story of a harmonious "Land of Smiles" is a fairy tale. Thailand is a country of secrets.

Many Thais have little respect for the crown prince and regard the prospect of him becoming king with dread. Queen Sirikit is deemed to be distanced from King Bhumibol and thought by some to be sympathetic to the ultra-right-wing "yellow shirts", who besieged Bangkok's airports in 2008 in an effort to topple the government. The military has consistently used the law to shield itself from critical scrutiny of its baleful role in sabotaging democracy.

Thailand's domestic media cannot report any of this, and the international media has resorted to explicit self-censorship. Journalists resort to vague hints when covering Thailand. As Pravit Rojanaphruk, one of the country's best correspondents, wrote this month: "The 'invisible hand', 'special power', 'irresistible force', all these words have been mentioned frequently lately by people, politicians and the mass media when discussing Thai politics, the upcoming general election and what may follow."

Three months ago I gained access to the "Cablegate" database of confidential US cables believed to have been downloaded by US soldier Bradley Manning in Iraq. There are more than 3,000 cables on Thailand. Unlike almost all reporting on the country, the cables do not mince words when it comes to the monarchy. As I read them I realised two things. They could revolutionise our understanding of Thailand. And there was no way I could write about them as a Reuters journalist.

Reuters employs more than 1,000 Thai staff. The risks to them were significant. In my 17 years at Reuters I've covered many conflicts; I spent two years as Baghdad bureau chief as Iraq collapsed into civil war. Several friends in the company have been killed. I've always been proud to work for Reuters. When I was told my story could never be published, I understood.

But I just could not accept giving up and ignoring the truth about Thailand. Thai people deserve the right to be fully informed, to debate their future without fear. With great regret, I resigned from Reuters at the start of June to publish my article for anybody who wants to read it.