It required an adjustment of preconceptions. Like many newcomers, I delighted at discoveries of Chinese literature and Daoist philosophy, Beijing parks, the edgy eccentricity of Dashanzi and the glorious mix of classicism and obscenity in the Chinese language, though I never managed to master it. The mix of communist politics and capitalist economics appeared to have created a system designed to exploit people and the environment like never before. It was so unequal that Japan appeared far more socialist by comparison. And it was changing fast. As swaths of the capital were being demolished and rebuilt for the Olympics, there was an exhilarating (and sometimes disorientating) sense of mutability. Everything seemed possible.

Looking back over the stories that followed, it is hard to believe so much could be compressed into such a short span of time – the outbreaks of Sars and bird flu, the attempted assassination of the president of Taiwan, deadly unrest in Tibet, the devastating earthquake in Sichuan, murderous ethnic violence in Xinjiang, Tibetan self-immolations, as well as the huge regional stories: two tsunamis – in 2004 in the Indian Ocean and last year in the Pacific, a multiple nuclear meltdown in Fukushima, and the protracted rattling of nuclear sabres on the Korean peninsula.

…

Run-ins with the police, local authorities or thugs are depressingly common. I have been detained five times, turned back six times at roadblocks (including during several efforts to visit Tibetan areas) and physically manhandled on a couple of occasions. Members of state security have sometimes followed interviewees and invited my assistants “out for tea”, to question them on who I was meeting and where I planned to visit. Censors have shut down a partner website that translated Guardian articles into Mandarin. Police have twice seized my journalist credentials, most recently on this year’s World Press Freedom Day after I tried to interview the blind human-rights activist Chen Guangcheng in hospital. When that happened, I debated with another British newspaper reporter who was in the same position about whether to report on the confiscation. He argued that it was against his principles for journalists to become part of the story. I used to believe the same, but after nine years in China, I have seen how coverage is influenced by a lack of access, intimidation of sources and official harassment. I now believe reporters are doing a disservice to their readers if they fail to reveal these limitations on their ability to gather information.

…

Treated like a spy, I have sometimes had to behave like one. At various times, I’ve concealed myself under blankets in a car, hidden in a toilet, waited until dark in a safe house and met sources in the middle of the night to avoid detection.

At other times, it is Chinese journalists and officials who pull the screen of secrecy aside. Take the foot-and-mouth outbreak on the outskirts of Beijing in 2005. I was first alerted to this by a Chinese reporter, who was frustrated that the propaganda department had ordered the domestic media not to run the story.

…

In the four years since, China has become a more modern and connected nation, but – despite the official hubris – it also seems more anxious that the uprisings in the Middle East and North Africa may spread. The government now spends more on internal security than defence of its borders – a sign that it is more frightened of its own people than any external threat.

Little wonder. This has been an era of protest in China. The government stopped releasing figures a few years ago, but academics with access to internal documents say there are tens of thousands of demonstrations each year. The reasons are manifold – land grabs, ethnic unrest, factory layoffs, corruption cases and territorial disputes. But I have come to believe the fundamental cause is ecological stress: foul air, filthy water, growing pressure on the soil and an ever more desperate quest for resources that is pushing development into remote mountains, deserts and forests that were a last hold-out for bio and ethnic diversity.

…

So why am I leaving? Well, over the years, I have come to feel increasing respect, sympathy and affection for China, but also more pessimism. Journalists here are worn down like brake pads on a speeding juggernaut. Such cynicism is not healthy. I hope a change of scene will allow me to see China – and the world – afresh. Regardless of Beijing’s choking smog, traffic and politics, it will be hard to match living and working in China.