By Andrew Cawthorne
CARACAS (Reuters) - Just months ago, with crowds of protesters baying on the streets for the resignation of the "dictator" and "murderer," Venezuelan President Nicolas Maduro looked like a goner.
Global opinion hardened against his socialist government, with Washington the first to impose sanctions. Coup rumors spread amid one of the worst economic implosions in modern Latin American history, and there were two botched mini-uprisings.
Yet the unpopular successor to Hugo Chavez has not only survived, he is ending the year on a political high and is even a front-runner for the 2018 presidential election.
The upturn in Maduro's fortunes began with a surprise victory in last month's gubernatorial elections, thanks to abstentionism by disillusioned opposition supporters and election conditions stacked in favor of his Socialist Party.
He then seized the initiative by announcing Venezuela's intention to restructure its more than $120 billion foreign debt. The high-stakes moves allows him to blame a U.S.-led "capitalist conspiracy" for hyperinflation and shortages while potentially freeing hard currency to import food and medicines ahead of next year's vote.
Government sources say a buoyant Maduro is now considering driving home his advantage by bringing forward the normally year-end election to February or March.
The president, so toxic last month that few gubernatorial candidates wanted to be seen with him, might now be his party's best bet to retain power against an opposition in disarray.
Speculation about alternative candidates - from powerful Socialist Party No. 2 Diosdado Cabello to up-and-coming governor Hector Rodriguez - has quietened in recent days.
"For sure Maduro will be the candidate. How can anyone challenge him?" said Dimitris Pantoulas, a Caracas-based consultant who tracks Socialist Party politics.
"Look at him on TV: He's bright and happy. He even dances better than before! 'Chavismo' has the momentum," he added, referring to the movement founded by Chavez.
Maduro is taking credit in government circles for pushing through a Constituent Assembly super-body that cemented the socialists' power - albeit in an election boycotted by the opposition and marred by fraud accusations even from the company running the voting machines - and for breaking the opposition coalition.
With the main parties within the opposition Democratic Unity coalition boycotting next month's mayoral elections, another win looks likely at the local level.
NO TO SANCTIONS
The 55-year-old leader is already touting his potential 2018 campaign theme: No to the "Yankee" sanctions.
Some believe that was one motivation behind the proposed debt restructuring: to force creditors into pressuring Washington to ease sanctions because they hinder any refinancing of Venezuela's obligations.
It is also part of Maduro's strategy with the opposition in talks due to start on Dec. 1 in the Dominican Republic.
"We must demand the Venezuela opposition reach a pact for 2018 to have presidential elections with economic guarantees, an end to U.S. government sanctions and an end to the financial persecution of Venezuela," Maduro said recently.
The government will also press for the opposition-controlled National Assembly to support debt refinancing, a potential way around sanctions that otherwise prevent U.S. banks from participating.
There has been no sign U.S. President Donald Trump would be willing to ease sanctions. On the contrary, a U.S. official told Reuters recently that Washington was weighing new sanctions in response to Maduro's crackdown on the opposition.
Though the opposition is trying to rally Venezuelans to oust the socialists once and for all in the 2018 vote, there is no hiding their woeful state.
Leaders struggled to explain the October gubernatorial poll defeat, first blaming fraud then admitting they shot themselves in the foot via abstentionism.
The coalition openly split over the Dec. 10 municipal elections, with major parties opting for a boycott but others deciding to run candidates. That confused strategy - a far cry from their unity in 2015 parliamentary elections - has undercut western pressure on Maduro.
Given that the opposition's most popular candidates are detained or banned from running, Maduro is goading veteran Democratic Action party leader Henry Ramos - a divisive figure, unpopular with many younger voters and hard-line opposition groups - to contest the 2018 poll.
With an unpopular president potentially facing an unconvincing opposition candidate, next year's election would seem to be fertile territory for a middle-ground aspirant.
"This is the best time for anyone proposing a different way," said dissident former 'Chavista' Nicmer Evans.
Putting his money where his mouth is, Evans is tramping the streets of Caracas to campaign for a mayorship at the Dec. 10 vote with a new party called New Vision For My Country.
Many Venezuelans say the best president would be Lorenzo Mendoza, the billionaire head of the Polar brewing and food company, whose ratings dwarf mainstream politicians. He, however, has shown little inclination.
Assuming Mendoza remains on the sidelines and no Socialist Party faction displaces a Maduro candidacy, he seems to have a real chance of retaining the presidency despite popularity levels that have been halved during his rule to around 20-25 percent.
A bigger threat than the opposition would appear to be social protests at the economic crisis, or a Zimbabwe-style move from within the military.
Cliver Alcala, a former "Chavista" general who is now an outspoken critic of Maduro, said rank-and-file soldiers were fed up with personal penury and the politicization of their institution.
Even so, he saw little appetite for an uprising and said the military top brass appeared to have a vested interest in supporting Maduro due to the influence he allows them.
"There is more possibility of a popular social outburst due to lack of food and medicine, and the constant abuses of authority," Alcala said.
That, however, is a cycle Venezuelans have lived through over and over in recent years: violent protests and national shutdowns coming at huge cost to life, property and productivity.
Through it all, Maduro has hung on - and for now is smiling again.
(Additional reporting by Deisy Buitrago and Diego Ore in Caracas, Matt Spetalnick in Washington; Editing by Alexandra Ulmer, Daniel Flynn and Jonathan Oatis)