Venezuela's mercurial president, Hugo Chavez, has encountered his first electoral setback since coming to power in a landslide in 1999, a mandate which was handsomely renewed in 2006. Though he was clearly upset Sunday by his narrow defeat by two percent of the votes, Chavez may in time come to see the political check as fortunate.

He sought in a referendum to do away with the two consecutive term limit on the presidency, thus allowing him to stand again in 2013. Other changes put to the vote included powers to limit press freedom, place the military under direct presidential command and to take away the autonomy of the central bank. Psephologists will doubtless analyze the vote more closely in the coming days but it already appears that a significant proportion of Chavez’s core supporters voted against the measures. They saw what the president evidently did not — that there were too many dangers in the proposed constitutional changes. Their reasoning may very well have been that if quasi-dictatorial powers were granted to the president, those powers would jeopardize the socialist program that he is pushing through by allowing his opponents to argue that it was a communist-style putsch. Besides, the thinking may have gone on, even if Chavez could be trusted with the new constitution, a future president from the right might not be.

There can be no doubt that Venezuela’s president remains hugely popular. However, he evokes detestation equally strong among his political enemies. It is the opposition domination of the media that informed the people of his proposal to have powers to control the press and broadcasters in times of “emergency.”

There was an ominous delay in the announcement of the referendum results as the president and his staff absorbed their defeat. Troops were ordered onto the streets to block entry to the National Electoral Council building. This may have merely represented Chavez’s shock at the outcome and a rapid rewriting of his victory speech, though some observers feared the president might have been planning more precipitate action. This judgment was probably wrong. Whatever his faults, his capacity to shoot from the mouth and his high-profile diplomatic stunts, Chavez is a democrat. He did not try to fix the referendum result; nor did he cry foul when he lost the vote. In the final analysis, albeit through gritted teeth, he accepted the verdict of the people.

His political opponents were celebrating noisily what they chose to believe is the start of a collapse of Chavez’s political power base. Among his most vigorous detractors are members of the elite that long ran Venezuela’s affairs and whose privileged positions and economic dominance he is seeking to reverse. They will doubtless wish to capitalize on the referendum result, but they are probably wrong to imagine that for the next five years of his term, Chavez will be a lame-duck president. The former paratrooper is a smart politician who has probably now learned a valuable lesson concerning the limits of power.