CARACAS, Venezuela — A group of soldiers turned against the government and declared allegiance to the opposition. Foreign officials say the government could soon run out of money to meet bare-bones needs. And countries across the region have called the president an illegitimate dictator.

Conditions in Venezuela have deteriorated to a point where the opposition — gutted by the jailing and exiling of many of its leaders and discredited after several failed efforts to oust President Nicolás Maduro — is seeing an opportunity. Leading them is a virtually unheard-of 35-year-old, Juan Guaidó.

His debut as opposition leader and head of the National Assembly this month has captured the attention of those within the country and outside of it — mainly for his striking claim that Mr. Maduro is not a legitimate ruler and his willingness to take charge of a transitional government.

“The relationship between Venezuela and its state today is one of terror,” Mr. Guaidó said in an interview. “When this happens, the voices and hopes of the world, their messages, are the encouragement for the daily struggle to resist — to dream of democracy, and for a better country.”