Venezuela might look bad right now with protests, scarce food and fraught political tensions. But it could soon get a lot worse, according to analysts, because of a debt emergency raising the specter of default.
Such a scenario would cut the oil-rich but cash-starved country off from capital markets. Lenders could seize assets -- tankers, refineries, accounts -- belonging to state oil company PDVSA. The humanitarian crisis could deepen as already limited imported essentials dry up completely and desperate citizens leave.
How close is Venezuela to defaulting on its debt, estimated at over $100 billion?
President Nicolas Maduro's government has so far gone to extraordinary lengths to service it, prioritizing debt repayments over all else, including badly needed imports of food, medicine and other essentials.
But all-important oil production and revenues have been declining, and its currency reserves have shrunk to just $10 billion. Most of that is in gold, locked away in Caracas as security for loans.
October and November will be a crunch period. That's when a hefty $3.8 billion in bond payments need to be paid by Venezuela and PDVSA.
Those amortizations "are a challenge, but the government likely will pay," Andres Abadia, senior economist at Pantheon Macroeconomics looking at Latin American issues, said in a July briefing note.
Nevertheless, he said, Venezuela was running out of cash and "we expect the situation in Venezuela will get much worse."
"The likelihood is rising that a deterioration of the current recession/near-hyperinflation economic scenario, and the political crisis, will trigger regime change," he said.
The legal credibility of Maduro's regime in standing behind its IOUs has been put on the line by the election last month of a controversial new loyalist body, the Constituent Assembly, which has power over all branches of Venezuela's government.
The United States -- under whose laws Venezuela's debt contracts are written -- does not recognize the assembly. It calls it an "illegitimate" tool for Maduro's "dictatorship" and has imposed sanctions on the president and some of the assembly's members.
The assembly "aggravates the reputational risk that already exists on PDVSA and Venezuela bonds," said Juan Carlos Rodado, head of Latin America Research at the Natixis investment bank in New York.
He noted that the leader of Venezuela's opposition-controlled legislature has "warned a future government might not honor new debt issued later on."
Many analysts say Venezuela's only option is to renegotiate its debt repayments. But international rejection of the Constituent Assembly -- also by the European Union -- may prove an obstacle.
"There is a growing consensus that Venezuela will not be able to persist for much longer with its policy of full external debt service," wrote Lee Buchheit of the Cleary Gottlieb Steen & Hamilton law office in New York and G. Mitu Gulati of the Law School at Duke University in a joint paper.
"This implies a debt restructuring of some kind." But holdout creditors would present "a serious, potentially a debilitating, legal risk," they said.
The biggest lenders to Venezuela have been China and Russia, which together have an estimated exposure of around $50 billion.
China loaned around $60 billion to Venezuela between 2007 and 2014, to be repaid in oil, which was sold for around $100 a barrel at the time.
But with oil prices sinking below $50 since 2015 and Venezuela struggling to provide the production needed, Beijing quietly shut off the credit.
It recouped some of what was lent, but is still owed "a great deal," said Francisco Monaldi, an energy policy expert at Rice University's Baker Institute in Texas and director of the Center for Energy and the Environment at the IESA business school in Caracas.
Venezuela "is sending 400 million barrels of oil a year to China to pay the debt -- and that is less than what it should be paying because the Chinese gave it a grace period due to the low oil prices," he told AFP.
Russia has been lending to Caracas since 2011, first with $2.8 billion in credit for Venezuela to buy anti-aircraft systems and other weapons, then since 2014 apparently through its state-controlled oil company Rosneft for at least $6 billion more.
As with China, some of that Rosneft debt is to be paid through oil shipments.
But Venezuela's oil production has been falling for the past two years, with the number of its active oil rigs dropping from 75 to 49, according to Pantheon Macroeconomics.
Together with the low prices -- and the 40 percent of output it ships to the United States, its biggest customer -- it has made it difficult for Caracas to meet its commitments.
Sceptical that it will keep up with its oil repayments, a former opposition Russian lawmaker, Dmitry Gudkov, wrote on his Facebook page that "investing in Venezuela is like hiding money in a burning house." The only rationale was to prop up an ally, he said.
As collateral for the Russian credit, Venezuela put up 49.9 percent of Citgo, PDVSA's US-based refinery and gas station subsidiary that Monaldi said was worth around $8 billion, "and it is in debt itself."
If a default were to happen, Rosneft could take over Citgo -- but that would likely fall foul of US sanctions on Russia.
"The US government will not be happy with the idea of having Rosneft taking control of a US-based refiner and fuel distributor," said Rodado.