Venezuela’s population is just shy of 30 million, and for the past 14 years Hugo Chavez had impressed enough of them to be elected to multiple terms as president. Yet his death this week represents an opportunity for the people of his country to return it to the international mainstream.

Chavez, who died Tuesday at age 58, had chosen a radical path: He nationalized the critically important oil industry, then used the profits to pursue his domestic political agenda, to bolster sympathetic regimes in neighboring countries, and to figuratively and flamboyantly thumb his nose at Washington — while also cultivating friendships with Cuba, Russia and Iran, three nations with decidedly strained relations with the United States.

He was immensely popular with Venezuela’s hitherto neglected working class, and understandably so. Previous governments in Caracas had been riddled with corruption and had carefully met the needs of the nation’s elite while overlooking the plight of the poor.

The tears that were shed upon the news of Chavez’s passing were genuine. He had set up health centers throughout the country to provide essential care to people who previously had none. He cultivated a reputation as a friend of the lower economic classes that had been ignored or even exploited by previous regimes.

But in giving Chavez their affection and their political support, they overlooked the flaws in his extremely uneven leadership. In fact, under his presidency Venezuela had developed glaring economic and structural weaknesses. While he won applause around the world for his political grandstanding against Washington (and let’s face it, a lot of people around the world view the United States with disdain), he allowed his nation’s oil industry to become highly vulnerable to economic distress.

History will no doubt depict Chavez in contradictory terms. The many good things he did — the things that enabled him to win one election after another — are offset by his miscalculations and his seemingly ego-driven quest for controversy and celebrity.

Here’s what one expert on the subject, Rory Carroll (the author of “Comandante Hugo Chavez’s Venezuela”), wrote in an essay in The New York Times this week: “The legacy of his 14-year ‘socialist revolution’ is apparent across Venezuela: the decay, dysfunction and blight that afflict the economy and every state institution.”

He also wrote that “the endless debate about whether Mr. Chavez was a dictator or democrat — he was in fact a hybrid, an elected autocrat — distracted attention, at home and abroad, from the more prosaic issue of competence. Mr. Chavez was a brilliant politician and a disastrous ruler. He leaves Venezuela a ruin.”

Nicholas Maduro, who as vice president now automatically succeeds Chavez, would disagree. But Maduro, a former bus driver, is relatively untested and faces a serious challenge in the election that the nation’s constitution requires within 30 days of a president’s death.

The issue that must be debated in the election campaign is what to do about the Venezuelan oil industry, which Chavez nationalized. When the international price of crude oil was high, it was a reliable source of income, but in recent times that price has fallen and so, therefore, have Venezuela’s oil revenues.

Even the prospect of the politically controversial Keystone XL pipeline, designed to deliver oil from Alberta, Canada, to American ports on the Gulf of Mexico, poses a serious threat to Venezuela’s principal industry and signals the need for the government in Caracas to recalculate its economic future.

Whoever succeeds Chavez will need to put aside the pointless theatrics and get serious about Venezuela’s economy.