The great city of Caracas spreads over innumerable mountainous hills, and in the rainy season the peaks poke up through the clouds that hover in the valleys below. Several million people live on these steep slopes in barrios, a word which, when translated into English as "shanty towns", does little justice to the reality. These are not just settlements of corrugated iron and wattle and daub, but mostly well-established homes of cheap breeze-blocks set in concrete frames. Their defining characteristic is close proximity, each tiny habitation piled high above the next, fighting for space.
A mass of humanity passes by, in perpetual movement. Some are white or of mixed race, but the great majority are dark skinned. Venezuela is poised geographically between Brazil and the islands of the Caribbean, and the children of slaves and native Americans far outnumber those of the European settlers. In one of the richest countries in Latin America, they live in permanent and absolute poverty. Many scratch a living as hawkers in the valleys below.
The air is clear, and the views are breathtaking. The atmosphere is that of a hill town in medieval Europe, though the facilities are more modern. Water and electricity are notionally available, but rubbish often piles up on the steep stone staircases and along the narrow terraces that criss-cross these immense urban conglomerations. These are unplanned pedestrian precincts, for no bus or car could negotiate these hills. Security is the principal concern; iron grilles and locked doors are the most important and expensive element in house construction.
From their hillside eyries, the poor look down on the settlements of the rich, the tiny minority of Venezuelans - mostly white - who live in sprawling condominiums with maids and swimming pools, and drive to work in air-conditioned cars along spreading motorways. South Africa springs to mind: Soweto versus the white suburbs of Johannesburg. There is no legal apartheid in Latin America, but it exists all the same. The white settlers have ruled the continent since the time of the conquistadors, and, in countries such as Venezuela, a steady stream of European immigrants over the past two centuries has reinforced the white elite and its inherent racism, a phenomenon that dominates the country's politics.
Three years ago, after a decade of crisis and the collapse of the old and corrupted political parties, the democratic political system threw up a man of the people as president. Of black and native American ancestors, and voicing the rough rhetoric of a provincial from the interior of the country, Hugo Chavez began to organise a revolution. A popular and charismatic former colonel, he recognised the affinities that existed between the soldiery and the people from whom they had sprung. Taking his cue from various 19th-century visionaries and revolutionary nationalists, including Simon BolIvar, the Venezuelan liberator of swathes of Latin America, he set about breaking down the barriers between the armed forces and the rest of society, deploying soldiers as the spearhead of development projects. A "BolIvar plan" was established, to use army barracks as schools, to share military medical facilities with the general population and to try to kick-start a moribund public sector into more dynamic action. It echoes Simon BolIvar's own alliance between army and people at the start of the 19th century, which made independence possible.
Discontent with the Chavez revolution among the country's white elite, from senior generals to conservative businessmen, was evident from the start. One counter-revolutionary coup d'etat failed in April - destroyed by just the alliance between soldiers and people that Chavez had been so painstakingly constructing - but another attempt is all too likely, possibly within weeks.
Chavez's experiment is the most interesting Latin American project since Castro's Cuban revolution. He is the first head of state to co-operate openly with the anti-globalisation movement, denouncing world leaders who "go from summit to summit while their peoples go from abyss to abyss". His model is a political rather than an economic project, and it owes as much to style and rhetoric as it does to precise policies. There is no suggestion that Venezuela would follow Cuba's statist model: rather, Chavez continues to support a mixed economy. His proposals for health, education and social security are not dissimilar to those proposed by the social democratic presidents of Chile and Brazil. He has resisted moves to privatise Petroleos de Venezuela, the nationalised oil company and the country's major foreign exchange earner, and one of his most notable achievements so far has been to stabilise the oil price at a reasonably high level.
To take the popular pulse, I spent a couple of days in the hills of Caracas. I stopped at one of the schools, where 15 teachers cope with 1,500 students, and a local organiser told me how the people had resisted the coup in April.
"We are not Chavistas here," he said. "We are revolutionaries. We have to defend this government, but we are more libertarian than they are. We defend Chavez because he's better than any president there has ever been. We think he's the product of our struggle. People recognise him as an equal. People who had never done anything before went to rescue the president. Now they have become very politicised, and are trying to organise themselves - more than ever before."
But not everyone in the hills supports the revolution. "I voted for Chavez," a self-employed plumber told me, "but now I regret it. I was completely deceived. I've seen no improvement. I don't want conflict between rich and poor, because if that happens where will I get work?" Echoing the views of the opposition, he argues that there was no coup in April. "It was a coup by the government against civil society. The military were protecting the civilians. There was a power vacuum."
When I came down from the hills, I went to see the "comandante", as he is often called, in his second-floor, private apartment at the Miraflores Palace. Chavez was sitting alone with some papers at the table of a sparsely furnished dining room that looks out on to a roof garden. A man in his late forties, dressed in slacks and an open-necked brown shirt, he looked relaxed, and considerably fitter than when I had last seen him six months earlier in Paris. I am a privileged visitor: I have met and interviewed him several times, and written his biography. He greets me as an old acquaintance, with a friendly hug.
A president used to glad-handing his way through crowds of supplicants, Chavez has been cooped up in the palace since the April coup, while his bodyguards - fearsome figures in black suits who carry briefcases that turn into bulletproof shields - practise new drills. He fears a magnicidio, the word the Spaniards use to describe the assassination of an important person. Another possibility is a "legal coup" - that the National Assembly might make a demand to secure his resignation. This device, much canvassed in the press, was used in Ecuador in the 1990s, and in Venezuela in 1993, when one of Chavez's predecessors, Carlos Andres Perez, was removed from office on charges of corruption.
"Well," says Chavez, "you've seen the pressure from the newspapers and within the National Assembly, but I think it's going to be very difficult for the opposition. I talked to our group of revolutionary parliamentarians the other day, and, after what happened during the coup, when many of them were pursued and threatened in their homes, they have drawn closer together. There used to be 86, now there are 90." Chavez, for now, has a clear majority.
What about an economic coup, I suggest, recalling Henry Kissinger's threat "to make the economy scream" when he was planning the overthrow of Salvador Allende in Chile in the 1970s. "It's quite possible they will try to generate economic trouble," says Chavez, "and make the country 'ungovernable' according to their definition, as was done in Chile. We are looking at all these scenarios, and we are seeking to regain the offensive, and to neutralise the opposition."
Every day in recent weeks, the television channels have shown the dramatic proceedings in the National Assembly, where a procession of generals and admirals implicated in the coup has been appearing before a parliamentary subcommittee. I cannot recall a time in Latin America when senior officers have been obliged to go through such a humiliating procedure. Yet everyone is exquisitely polite during the interrogations, and the generals are arrogantly self-righteous. They are now all on the retired list, but they think they can make a comeback. I watched as one distinguished-looking officer in his fifties, with close-cropped hair and a grey uniform covered with decorations, argued that he had acted out of duty to the nation and the armed forces. He complained that the military had been dragged in to politics, and that this had involved humiliation for officers and their families. He recalled how people had tinkled their glasses when he and his wife entered a restaurant, not as applause but as a gesture of contempt.
Talking to Chavez, I recalled the case of General Carlos Prats, Allende's commander-in-chief in Chile in August 1973, whose family home in a comfortable suburb had been surrounded by middle-class women banging saucepans. He felt obliged to resign, giving way to General Pinochet. He and his wife were killed by a car bomb in Buenos Aires the following year. Was there not a danger in Venezuela of this pattern being repeated?
Chavez agreed that "an important number of senior officers have acquired a standard of living that is comparable to that of the upper middle class. They have been subjected to these pressures and attacks, in the places that they go to and within their family circle, and this certainly helped to undermine the unity and strength of this sector of the military leadership." Yet he pointed out that "a considerable number of senior officers did not give in to these class pressures. They refused to allow themselves to be neutralised. At some personal risk to their lives, and their military careers, they stood up at the most critical moment and expressed their view in support of the constitution." It was these elements in the military who got the support of the people. "Hundreds of thousands of people all over the country came out against the coup. And where did they go to? They assembled at the army barracks, and they did so because of the existing understanding that had been built up between officers and civilians by Plan BolIvar."
I flew to the oil town of Maracaibo, in the west of the country, to talk to the only newspaper owner in Venezuela who has refused to join in the general press demand for Chavez to resign. Esteban Pineda Belloso is the owner of Panorama, a wealthy, well-established, family-owned daily paper, with the second-largest circulation in the country. On the day of the counter-coup, when the Caracas papers closed down for a day, in shock at the defeat of the insurrection they had promoted, Panorama kept going, producing four separate editions, recounting each successive stage of Chavez's return to power.
Pineda was one of the few people I met who was optimistic about the future. He thinks that the opposition's efforts to get rid of Chavez by constitutional means are bound to fail, and he thinks that an "economic coup" would probably hurt the businessmen involved more than Chavez. As for the military, Pineda believes that the last thing they want is to involve themselves in another coup. They just want to return to cultivate their gardens.
It is true that Venezuela's traditional political class has revived somewhat after stunning defeats in a series of elections after 1998, but it still has no popular mandate. It can point to its unusual capacity to mobilise large sections of the middle and upper classes in anti-government demonstrations on the streets of Caracas, but nobody knows what its real electoral strength might be. The opposition is divided into a dozen individual parties, and in no way represents a solid electoral force. No obvious opposition leader has emerged, and no agreed programme has been promoted.
The April coup threw up a particularly hopeless businessman, Pedro Carmona - now derided as "Pedro el Breve", Pedro the Brief - without a political bone in his body. His only programme was to abolish the National Assembly and the new constitution, which had been long debated by a popularly elected assembly and ratified by referendum.
The outlines of what an opposition government would do are well known. It would reintroduce a neoliberal programme, with the attendant privatisation of state enterprises, of the kind being applied almost universally in Latin America. It would privatise the oil industry, withdraw from Opec and increase oil production.
The opposition tends to believe its own propaganda. Because the protest marches against the government have been unusually large, and because the opinion polls at the beginning of the year appeared to indicate a decline in support for Chavez, a euphoric feeling arose in the upper middle class, and among its spokesmen and columnists in the media, that one more push would bring about the president's downfall.
In practice, in my experience of Latin America, opinion polls provide no guarantee of accuracy because the pollsters do not reach into the areas where the great majority of the people live. Protest marches, too, are an unreliable guide. They can be very large, but this does not mean that this symptom of discontent will translate into votes. Journalists and commentators here rarely get out and about to make their own, old-fashioned, informed guesses about the state of public opinion.
My impression is that a rock-solid majority for Chavez, based on class and race, remains intact. For the first time in Venezuelan history, the country's hidden majority - black, indigenous and mestizo - have a president with whom they can identify. Things may not have gone too well for them in the past three years, and some sections of the poor may have got even poorer. But they also face overt racism from the country's ruling elite. It is clear that Chavez is a president in whom they still have faith, and whom they will defend.
Richard Gott's book In the Shadow of the Liberator: Hugo Chavez and the transformation of Venezuela is now available in paperback from Verso