CARACAS, Venezuela — Venezuela's ruling socialist party swept mayoral races in most of the state capitals and major cities in Sunday elections boycotted by several opposition parties, officials announced.
The ruling party won in 41 of 42 cities where a winner was declared, according to early official results. The opposition even lost in strongholds such as Maracaibo and the Caracas-area district of Sucre.
Around 47 percent of eligible voters cast ballots. That was down from 58 percent in municipal elections four years ago, as three of the four major opposition parties refused to field candidates because of irregularities and allegations of fraud in recent gubernatorial elections.
Socialist President Nicolás Maduro responded on state television by threatening to ban the boycotting groups from future political contests.
"A party that has not participated today cannot participate anymore," said Maduro, who called Sunday's turnout "extraordinary."
The election of mayors in all of Venezuela's 335 municipalities was the last national balloting before next year's presidential contest, in which Maduro is expected to seek re-election despite his steep unpopularity.
Various polling places appeared to be sparsely filled throughout Sunday, with only handfuls of people seen casting ballots.
"Let's hope they're late sleepers and this isn't a phenomenon of abstention," said retired librarian Jose Tomas Franco, an early-morning voter in the capital, Caracas, who called the low turnout "alarming."
The elections took place against a backdrop of soaring inflation, shortages of food and medicine, and charges that Maduro's government has undermined Venezuela's democracy by imprisoning dissidents and usurping the powers of the opposition-controlled National Assembly.
Related: E.U. readies sanctions on Venezuela, approves arms embargo
Economic and political crises have caused the president's approval rating to plunge, although the opposition has largely been unable to capitalize on his unpopularity.
Given the opposition's disarray, political analysts said they doubted that Maduro's opponents would be able to rally behind a single candidate in next year's presidential election.
"The opposition is condemned to trying to find a solution to its internal problems," said Edgard Gutierrez, coordinator of Venebarometro, a Venezuelan polling agency. "Either that or simply not compete in 2018."
The last time the opposition refused to compete, in congressional elections in 2005, it strengthened the government's hand for years.