Pro-government supporters wave flags and chant near a relocated polling center ahead of gubernatorial elections in Caracas, Venezuela, on Oct. 15. (Wil Riera/Bloomberg News)

Can you have a real election in a fake democracy? That’s the question Venezuelans were left to ponder after Sunday’s election for state governors, which saw President Nicolás Maduro’s ruling United Socialist Party sweep to a stunning victory, taking at least 17 of Venezuela’s 23 states and winning 54 percent of the popular vote.

At first sight, this result looks wildly improbable. Maduro’s popularity has been stuck in the 17 to 22 percent range for years now, as Venezuela spirals into a shocking economic and even humanitarian crisis. Surely a government can’t win a free election in a country where 93 percent of the people say they can’t afford to buy enough food for their family?

The first explanation is the most obvious. The term “free election” doesn’t entirely make sense in a country where any distinction between the government and the ruling party has been almost completely erased. Government officials blatantly used state resources to support ruling party candidates — including endless ads for ruling party candidates on state TV, or using government funds to finance candidates. These things are technically illegal, but who’s going to stop them? The courts are in no position to call them out on it. They’re stacked with government loyalists from top to bottom.

The five-member National Electoral Council has long since done away with any pretense of impartiality: four of its members barely bother to hide their obvious support for the government. Just hours before the vote, the council announced it was moving hundreds of heavily pro-opposition polling stations. The move left more than half a million voters, 80 percent of them opposition supporters, scrambling to figure out where they were supposed to vote.

The council announced that voters could check if their polling station had been moved by sending a text message (with national ID number) to a special number. When they did, the system replied with a text giving the location of the new polling place — and then reminded them that “The people’s candidate in your state is …” followed by the name of the candidate of the ruling Socialist Party.

Election Day itself saw hundreds of reports of irregularities, including of vote-buying and acts of violence and intimidation against opposition witnesses at polling stations. Public-sector companies transported their employees to polling stations and threatened them with firing if they didn’t vote. It goes without saying that the government did not allow credible international observers to monitor the vote.

One dirty trick was especially galling. In a country where millions depend on subsidized food distribution to stay alive, the government declared that its electoral technology enabled it to know exactly who had voted — though it stopped short of explicitly saying that it knew whom they had voted for. It didn’t have to. Venezuelans got the message.

In short, what happened Sunday scarcely resembled a free and fair election. But neither was it an Azerbaijan-style farce with the announced results entirely disconnected from the underlying votes cast. Venezuela’s election system contains relatively robust checks that would leave clear evidence in the opposition’s hands if that happened.

As far as we can tell, it didn’t. Out of the 10,800,016 votes cast, 54 percent really did go to the government. (And turnout, at 61 percent, was relatively high.) Were some of those votes the result of ballot stuffing? Circumstantial evidence suggests they may have been. Opposition witnesses were forcibly removed from polling stations in many rural areas. That may have swung some close races, but it can’t account for a nine-point advantage in the popular vote.

Venezuela’s opposition has won elections in the past even when the playing field was obviously tilted in the government’s favor. The irregularities we saw on Sunday were blatant, widespread and serious, but they certainly didn’t come as a surprise. Every election in the past decade has seen variations on these tactics. Outrage over blatantly unfair voting conditions would have made grounds for the opposition to boycott the vote (as, indeed, a substantial minority of opposition leaders urged). But this still looks like a weak excuse for losing.

The grim reality is that the opposition’s morale is at rock bottom. Over the past few months Venezuela has been rocked by a protest movement that resulted in more than a hundred people dead, hundreds of others imprisoned, and the government’s hold on power undiminished. Exhaustion has set in. Millions of people who had turned out to vote for the opposition in the past just didn’t turn out. The government cheated, but it also won. Both things are true.

Sunday showed that the government is still able to win elections without having to fabricate the voting tallies out of whole cloth. Deploying the full range of dirty tricks to suppress opposition voters and turn out its own supporters (and employees) is enough.

So Venezuelan elections aren’t free and they’re certainly not fair, but they are competitive: After all, the opposition did walk off with five governorships, including Zulia, the nation’s most populous state. The resulting optics are just democratic enough to buy the government a minimum of democratic credibility abroad without seriously imperiling its hold on power. From Maduro’s point of view, it’s the best of both worlds: a real election win in a fake democracy.