A slow-simmering political crisis that has gripped Venezuela for months appeared to be coming to a head this week as opposition politicians issued a direct challenge to the authority of President Nicolás Maduro.The leader of the opposition, Juan Guaidó, called for a military and popular uprising to oust Mr. Maduro from office, triggering a day of protest that turned violent but later fizzled. Mr. Maduro characterized the action as unconstitutional, while Mr. Guaidó maintained it was a necessary move to restore legitimacy to the presidency. Both sides now seem to be scrambling for control, with Mr. Maduro appearing alongside troops on Thursday to reaffirm his status and Mr. Guaidó admitting he does not have the necessary support. This week’s attempted uprising failed to change the status quo. But the confrontation has been years in the making, driven by an economic downturn and political discontent. Here’s what you need to know to understand how Venezuela came to this moment.Venezuela is a country made rich by oil, and has seen that wealth evaporate.Venezuela has the largest proven oil reserves in the world, and the country’s economy is largely tied to its oil wealth. This oil wealth once made the nation one of the richest in Latin America and helped stabilize its democracy although the riches were not equally shared. But the past few years have seen the economy spiral toward collapse.The International Monetary Fund predicts that Venezuela’s inflation rate will reach 10 million percent in 2019, becoming one of the worst cases of hyperinflation in modern history. Experts say government mismanagement and corruption is the source of the country’s economic woes; Mr. Maduro blames damaging United States sanctions.The legacy of Hugo Chávez looms large in Venezuela.The legacy of President Hugo Chávez — Venezuela’s former leader and founder of the country’s modern socialist system — still hangs over the nation more than six years after his death. Mr. Chávez came to power in 1998, elected after a failed coup. He quickly rose from political outsider to popular figurehead, bringing in a socialist ideology that redistributed the country’s oil wealth and created a robust social welfare program. His government seized private factories, mines and fields, and founded state companies and cooperatives. High oil prices contributed to a short-term reduction in inequality and poverty as social programs made food, housing and health care more widely available.Within the country, the notoriously charismatic leader proved popular, but not universally so. During his years in office — he was re-elected in 2006 — his leftist ideology and bombastic approach to foreign relations proved polarizing. While his programs drew broad support from poor Venezuelans, they also alienated some of the country’s wealthy elites. Maduro is Chavez’s chosen heir. Before his death in 2013 from cancer, Mr. Chávez hand-selected his heir — Mr. Maduro, the current president. Adherents of his left-wing political ideology are known as Chavistas, and the group makes up the majority of Mr. Maduro’s current support base.Like his predecessor, Mr. Maduro increased the executive branch’s control of the country. He has made strides to dismantle the country’s opposition-led legislature. And he oversaw a redrafting of the constitution that consolidated power under the presidency, steering the country toward autocracy, and moved to quash all dissenting voices through violence and intimidation.The move drew reprimands from opposition politicians at home and from leaders internationally.Two men — Maduro and Guaidó — are now vying for control.In January, Mr. Maduro was sworn in for a second term in office after an election that was widely denounced as fraudulent. Two weeks after the inauguration, Mr. Guaidó, then a little-known 35-year-old leader of the opposition-controlled National Assembly, declared himself the interim president, pointing to the constitution to declare Mr. Maduro’s presidency illegitimate. He vowed to hold new national elections.The announcement brought tens of thousands of supporters to the streets, catapulted him to the international stage and saw the United States, Canada, and many Latin American and European countries recognize him as the legitimate head of state. As a result, Mr. Maduro cut off the few remaining diplomatic ties with the United States.The months since have been a tug of war between the two sides for popular support and control of the military. Mr. Maduro still has the backing of the country’s top generals, a loyalty that Mr. Guaidó may have underestimated as he called for the military to throw their support behind him. Mr. Maduro believes Mr. Guaidó’s effort to oust him is part of a coup engineered by the Trump administration.The power struggle has played out in competing street demonstrations and with dual messaging to the population. Last month, Mr. Guaidó and his foreign allies tried to bring large amounts of aid into Venezuela from neighboring countries, but Mr. Maduro’s forces sealed off the borders with Colombia and Brazil, saying the country didn’t need the support. His government later agreed to allow Red Cross aid into the country, which is currently suffering from a widespread humanitarian crisis triggered by the economic downturn. The country’s humanitarian situation is dire.