I chose not to stay in Beijing for the games - it is a city drained of joy

The air was muggy, and a haze hung over Beijing as if it was yet to wake up, although it was midday. I had decided months before that I would be there for the opening ceremony of the Olympics, and share the excitement. But as I drove in from the airport there were no welcome banners, no colourful flags on the lampposts, no billboards or Olympic posters. It was only three weeks till the big day, after seven years of waiting and meticulous preparations. It was to be the "dream of a century" for the Chinese. But the atmosphere was dead.

The fast lane of the airport expressway and all the ring roads were marked with the five circles of the Olympic symbol. No cars dared to enter them. The traffic moved unusually freely, as half the city's 3.2m cars have been taken off the road to reduce congestion and help clean up the air. There were few foreign tourists either; the air hostess told me on the way over that Air China flights were being cut back as visas had been drastically restricted to keep out potential troublemakers. I got home in record time.

I was startled to see a police car parked outside my apartment complex, and two volunteers in blue and white torch-bearer T-shirts standing at the crossroads. The porter was in military khaki. Instead of greeting me as he usually did, he demanded proof of my residence. I asked him the reason for this change: "Don't you feel safer?" he asked.

Later I popped out to get the local papers and magazines, and they were full of alarm, bombs in Kunming, suspicious white powder on a plane, anti-aircraft missiles being installed by the Bird's Nest stadium ready for any attack. There were to be security checks on the Beijing underground, and checkpoints at frequent intervals on the highways into the city. "Even if they dare to commit any crime during the Olympics, they won't be able to escape easily," the Beijing Evening News said. Where was the joy, the sense of celebration?

I had last been here in early March, just before the demonstrations in Tibet and the violence at the torch relay around the world. The mood was boisterous then, with eager anticipation as the giant clock ticked away on Tiananmen Square counting down to the start. "Give us 16 days of Olympics, and be rewarded with 5,000 years of our civilisation," was a slogan I remembered well. The only questions were: would the stadium and various other sites be finished on time, what about the traffic jams, how could the visitors be made to feel at home, would Chinese athletes collect more golds than America? Above all, how could our Olympic games become the most successful, the most memorable in history?

Now the Olympics are here, but the buzz has gone. The only tangible reminder of it has been the torch relay inside China, in which the rest of the world was scarcely interested. Even that was highly staged, with a very visible police and security presence. The commentators on China Central Television even told their audiences to sit at home and watch it on television. A subdued nervousness permeates Beijing.

Critics say the Chinese government is exaggerating the terror risk to extend its control. But is it really necessary to have this high security, I asked a Chinese friend, who is not very patriotic. "Yes," she said. "It is all the foreign devils. Better to have a safe games than a farce like the torch relays in London, Paris, and San Francisco. It was such a loss of face. We don't want it here on our soil."

For the government too, the risk seems real. They started with "One World, One Dream": they believed that China would be welcomed on to the world stage and galvanised frenetic popular support. When the western media protested at the award of the Olympics to China, the government felt it would overcome its critics by dazzling the world with its brilliant display. They failed to appreciate the importance the world would attach to the pledges they had given on the environment, human rights and press freedom. Surely diplomacy means engaging with the world on the world's terms, not just on your terms?

Then the protests against the torch relay produced a sea change. Fear of disruption, or worse, hostage-taking and killings like Munich in 1972, took over. The government's new line was only confirmed when 16 policemen were killed in an attack in Xinjiang, in western China, on Monday, just four days before the opening ceremony. A government spokesman said the attackers wanted to "make 2008 a year of mourning for China". Now a headline in the Beijing Evening News said it all: "A safe Olympics is the most important gold medal." At any cost, even the jubilation of the whole country.

I came back to England. If watching the Olympics on television is now the choice of the Chinese, I thought I would rather do it in London. But then I was overwhelmed by the avalanche of criticism in the British press and TV coverage: "'Police-state wastes goodwill', says stadium designer"; "Beijing Olympics: the spying games", "Clegg urges PM: don't endorse these tainted Olympics", "Queasy rider - US cyclists combat pollution", "Britons arrested for flying pro-Tibet banners", "Tiananmen orchestra cannot drown out the chorus of protests" - and many, many more, ranging from abhorring the "hideous" Bird's Nest, to accusations of exploiting the migrant workers who built it. This is not fact-finding but fault-finding. And now, at the eleventh hour, Bush has rasped at China's record on human rights and religious freedom, fanning the flames.

China certainly has faults. But reading the papers and watching the news, you might think the country has nothing to take credit for. Do a billion Chinese not deserve their day in the limelight, their moment of rejoicing? The western press seems to equate the Olympics with the Chinese government, not the people - and the people must wonder what they have to do to win some approval.

As a Chinese writer and film-maker, I have tried to tell the truth about China - most recently spending a year in Tibet, documenting the lives of ordinary Tibetans, their dreams and their frustrations. I know the problems all too well. But as the writer VS Pritchett once said, the only worthwhile criticism is "lit with a gleam of sympathy". The reforms that have produced China's vibrant cities, its new prosperity and new freedoms, only started 30 years ago in 1978. We still have a long way to go. But covering China with nothing but shame is not going to help us get there. As we Chinese say, you don't make a seedling grow faster by pulling it up and stretching it.

We can expect more demonstrations in Beijing during the games, especially with the kind of encouragement given by the western press. The Chinese government would do well not to overreact to the protests or the criticism, with 25,000 foreign journalists focusing on them. They should be confident in the knowledge that the majority of the Chinese are behind them, at least on the games. I'm sure it will be a great and memorable - and safe - spectacle. I will be watching it, and so will half the world. But I shall be wishing that my countrymen and women were dancing in the streets.

Sun Shuyun, the author of A Year in Tibet and the director of the BBC4 series of the same title.