(CNN) When Venezuelan President Nicolas Maduro secured another six-year term last May in an election widely seen as sham, the former Caracas bus driver declared himself "a better-prepared president and human being right now."

But two weeks after being sworn in, the anointed successor of the late socialist firebrand Hugo Chavez is facing the biggest challenge to his turbulent political career.

A relative newcomer, opposition leader Juan Guaido , this week declared himself Venezuela's acting president on a day of massive anti-government protests.

Several nations -- including the United States and Canada -- have officially recognized his presidency. Others, including China and Russia, still support Maduro.

A defiant Maduro appeared before a crowd of supporters outside the Miraflores presidential palace Wednesday to declare, "We will not surrender."

President Nicolas Maduro, left, and opposition leader Juan Guaido.

Here's how a country on a prolonged political and economic collapse reached a new low point.

A decade of decline

Through nearly a decade of mismanagement , Venezuela has squandered its profound oil wealth, leaving its economy in tatters and Latin America reeling from an unprecedented mass exodus of migrants in search of food and medicine.

The UN estimates as many as 3 million Venezuelans have left the country since 2014.

They are fleeing shortages of medicine, food and staples such as milk, flour and toilet paper -- along with rolling blackouts, rising unemployment and soaring violent crime.

Over the years, Maduro continued the huge social welfare programs and price-control policies of Chavez, who was seen by many as a champion of the poor as he steered the country toward socialism.

Venezuela holds the world's largest supply of crude oil, which once seemed to guarantee an endless flow of cash for the government. But plummeting oil prices in 2016 triggered an economic implosion that continues today. The oil-dependent country lapsed into political turmoil and economic misery, including hyperinflation and massive shortages of food and other necessities.

Venezuelans take to the streets in 2017

The country was rocked by deadly protests that year as opposition leaders faced off with Maduro and his backers.

Anti-government protesters accused Maduro of creating a dictatorship. They clashed on the streets with members of the armed forces.

Maduro was defiant and confrontational, calling the protesters "vandals and terrorists."

The anti-Maduro factions were further infuriated when the government notified main opposition leader Henrique Capriles in April 2017 that he was banned from political work for 15 years.

Demonstrators clash with riot police during an anti-government protest in Caracas on July 20, 2017.

That summer, the United Nations' human rights office accused Maduro's regime of excessive force and arbitrarily detaining thousands of people amid months of sometimes deadly anti-regime protests.

By that time, more than 120 people had died in protest-linked incidents. Critics accused Maduro of illegitimately consolidating power, including stacking the Supreme Court with loyalists and holding an election for a new legislative assembly packed mostly with his backers.

Maduro's disputed re-election

When Maduro was re-elected in May 2018, many eligible voters boycotted the vote. The country's electoral board placed turnout at a lackluster 46%. That was far below the 80% rate in 2013, when Maduro rose to power after the death of the popular Chavez.

The United States said it would not recognize the election results. And even before the polls opened, the European Union and several of Venezuela's Latin American neighbors were warning of an unfair election.

Venezuelan President Nicolas Maduro addresses supporters after election results on May 20, 2018 in Caracas.

An alliance of 14 Latin American nations and Canada declared the vote illegitimate. They included Argentina, Mexico, Brazil, Chile, Colombia, Panama, Paraguay, St. Lucia, Guyana, Peru, Honduras, Guatemala and Costa Rica.

Maduro was sworn in earlier this month, eight months after the contested election.

The International Monetary Fund predicts inflation will hit 10 million percent in 2019. The Maduro regime has continually raised the minimum wage, fueling ever more inflation, so every raise actually buys Venezuelans less and less each month.

Maduro blamed what he calls US economic terrorism for Venezuela's ills. Meanwhile the Trump administration has sought to pressure Maduro with targeted financial sanctions.

The emergence of Juan Guaido

The little-known politician has been a leader of the opposition and head of the National Assembly for merely three weeks. Still, the 35-year-old has managed to tap into the frustrations of the populace and quickly energize them against Maduro.

He became politically active while studying industrial engineering at the Universidad Católica Andrés Bello in Caracas.

Guaido was among protesters who blamed Chavez for what they said were his attempts to control the press.

He was also part of a group of young leaders who founded a political party in 2009 called Voluntad Popular -- Popular Will -- along with his mentor, Leopoldo Lopez, one of the best-known faces of the opposition. Lopez is now under house arrest.

The party mission was to combat poverty and to restore democracy.

Juan Guaido speaks during a mass opposition rally in Caracas on January 23.

Guaido emerged from virtual political obscurity when he was named president of the National Assembly on January 5. He joined the legislature in 2011, serving as an alternate until he was elected in 2016 as representative for the state of Vargas, a position he currently holds.

On Wednesday, Guaido declared himself acting president in a dramatic swearing-in before throngs in Caracas.

He said the day marked the beginning of an unstoppable movement to restore independence and democracy. He also called for new elections.

"We know this will have consequences," he said.

Sporadic clashes erupted between security forces and protesters. News footage showed National Guard members launching tear gas canisters at demonstrators.

Ten people died in protests across the country on Wednesday, Marco Antonio Ponce, executive director of the local NGO Observatorio Venezolano de Conflictividad, told CNN.

CNN has not independently verified the death toll and no official figures have been released by the government.

Confusion over Venezuela's political future

What happens next remains uncertain.

Venezuelans find themselves with two declared leaders, unrest in the streets and foreign powers divided about who to recognize as the legitimate president.

Hours after President Donald Trump recognized the Guaido presidency, a defiant Maduro gave US diplomats 72 hours to leave the country.

Venezuelan demonstrators set up a barricade during a protest against the government of President Maduro on January 23.

The embattled Maduro wore his presidential sash during an appearance before Venezuela's Supreme Court on Thursday. He announced in a speech aired live on state broadcaster VTV that he was closing the Venezuelan embassy and all consulates in the US and recalling all diplomatic staff.

The speech came hours after US Secretary of State Mike Pompeo urged the Organization of American States to support Guaido's interim presidency. He referred to Maduro's regime as "now defunct" and "illegitimate."

Venezuelan Defense Minister Vladimir Padrino Lopez also appeared on state television Thursday, surrounded by his high command, to pledge his support to Maduro. He called the developments of the previous day "horrifying" and described the allegiance of the armed forces for the president as "total."

"We swore to die for our homeland, for our Venezuela, and we are going to comply," he said.

Meanwhile, UN Secretary-General Antonio Guterres has called for dialogue.

And it remains to be seen whether Maduro can maintain complete control of the armed forces. Guaido has offered amnesty to all service members who break with Maduro.

A day after presenting Maduro with the biggest political challenge of his presidency, Guaido mostly stayed out of the public eye.