Venezuela's powerful military threw its weight behind President Nicolas Maduro on Thursday as the US-backed opposition leader Juan Guaido pressed a direct challenge to his authority, and the fate of the crisis-wracked country hung in the balance.
As the death toll from days of street protests jumped to 26, a defiant Maduro announced the closure of Venezuela's embassy and consulates in the United States, a day after President Donald Trump's administration declared his regime "illegitimate."
The oil-rich but economically devastated country was plunged into uncertainty Wednesday when Guaido, the 35-year-old head of the National Assembly, proclaimed himself "acting president" -- earning swift endorsement from Washington and a dozen regional powers including Brazil, Argentina and Colombia.
Maduro's reelection last year was contested by the opposition, and criticized internationally -- but the socialist leader has until now retained the loyalty of the powerful military, whose response was being keenly watched.
Flanked by military top brass, Defense Minister Vladimir Padrino, himself a general, declared the 56-year-old Maduro "the legitimate president" -- and vowed to defend his authority against an attempted "coup d'etat."
Following Padrino's lead, eight generals in turn reiterated their "absolute loyalty and subordination" to the socialist leader in messages carried on state television.
And the Supreme Court -- made up of regime loyalists -- doubled down by reaffirming its allegiance to Maduro's "legitimate authority."
"A coup is brewing in Venezuela with the consent of foreign governments," charged the court's president Maikel Moreno.
In a Skype interview with Univision, Guaido said he did not rule out including Maduro in an amnesty he is offering for military and civilian officials who lead a transition in Venezuela. But he said such an option would have to be evaluated because, he said, Maduro is responsible for the death of protesters.
Analysts at the Eurasia Group consultancy noted that while international recognition of Guaido as Venezuela's interim president cemented his position as the main opposition leader, he had failed to win over senior elements of the military.
In that light, "Maduro's fall does not appear imminent," the analysts wrote.
In Washington, Secretary of State Mike Pompeo kept up the pressure on the leftist leader, as the United States called for an emergency UN Security Council meeting on the crisis.
"The time for debate is done. The regime of former president Nicolas Maduro is illegitimate," Pompeo said in a speech to the Organization of American States, warning him against the use of force towards demonstrators.
A furious Maduro on Wednesday issued US diplomats a 72-hour deadline to leave the country, and on Thursday said he was recalling all Venezuelan diplomats from the United States.
The State Department meanwhile ordered its non-emergency staff to leave Venezuela but refused to comply with a full expulsion, saying it would maintain diplomatic ties with "the government of interim President Guaido."
Trump meanwhile has openly mused about military intervention in Venezuela, saying "all options are on the table," and analysts suggest he could consider further economic sanctions against the country, a third of whose oil production goes to the US.
The Republican president has found rare support from the Democratic Party over Venezuela, but one prominent dissenting voice was independent Senator Bernie Sanders.
"We must learn the lessons of the past and not be in the business of regime change or supporting coups -- as we have in Chile, Guatemala, Brazil and the Dominican Republic," the 2016 presidential hopeful said in a statement, while also condemning Venezuela's crackdown on protesters.
Outside South America, the United States has been joined by Canada and Britain in recognizing Guaido as Venezuela's interim leader, while France has also rejected Maduro's legitimacy.
But both Russia and China and have thrown their weight behind the embattled Maduro.
Russian President Vladimir Putin called Maduro to express support, charging that the "crisis has been provoked from the outside."
China, Venezuela's main creditor, opposed "interference in Venezuelan affairs by external forces."
Maduro has retained the support of Mexico, Cuba and Bolivia, all led by leftist governments.
Maduro has presided over a deepening economic crisis that has left the country facing shortages of basic necessities such as food and medicine.
Some 2.3 million people have fled the country since 2015, according to the United Nations. Inflation is forecast to hit 10 million percent this year.
Guaido's bold move capped three days of high tension that began Monday when a group of soldiers took over a command post in the capital Caracas and rose up against Maduro.
That uprising was quickly quashed and officials said 27 people were arrested but it set off a wave of smaller protests that were met by security forces using tear gas and rubber bullets.
Wednesday then saw the first mass street protests in Venezuela since a crackdown on anti-government protests between April and July 2017 claimed the lives of 125 people.
Leading figures around the world have appealed for calm to avoid a repeat of the bloodshed -- as a Caracas-based NGO, the Social Conflict Observatory, said 26 people had been killed since this week's protests began four days ago.
Speaking at the World Youth Day in Panama, Pope Francis's spokesman said he was "praying for the victims and for all the people of Venezuela."