Bolivia's Congress accepted the resignation offer of President Carlos Mesa late Thursday night and replaced him with the head of the Supreme Court, Eduardo Rodriguez, who is expected to fill the office until early elections can be held later this year.
The Bolivian constitution called for Senate President Hormando Vaca Diez to succeed Mesa, but the same groups that forced Mesa out with massive street protests demanding nationalization of the country's fuel sector had said they would try to topple any government led by Vaca Diez.
Late in the evening, Vaca Diez and Mario Cossio -- the leader of the lower house of Congress and second in line for the presidency -- announced they would decline the job.
That cleared the way for Supreme Court president Rodriguez to assume the post after Congress approved Mesa's resignation in a special session in Sucre, the nation's traditional capital.
Many of the protesters who filled the streets to preemptively rally against Vaca Diez had demanded that Rodriguez be allowed to become president. Vaca Diez or Cossio would have been free to serve the remainder of Mesa's term, which expired in 2007. Rodriguez is constitutionally obliged to call new elections within five months.
Mesa, who submitted his second resignation offer in three months during a televised speech Tuesday evening, had urged Vaca Diez to surrender his chance at the presidency to avoid rioting and bloodshed.
"This is an exhortation for a country that is on the verge of civil war," Mesa said during his speech.
Bolivia's military chief said Thursday that the armed forces would support Congress's choice of a successor to Mesa and added that it might intervene to ensure the transfer of power.
But with Vaca Diez stepping down to meet one of the central demands of many protesters -- including congressional opposition leader Evo Morales -- the likelihood of violence seemed to abate.
The Senate leader is a rancher from the relatively wealthy province of Santa Cruz, where most of the country's natural gas reserves -- the second-largest in South America -- are located. Many in Santa Cruz's business community have pushed for more autonomy from the federal government in the administrative capital, La Paz.
Demonstrators demanding nationalization of those reserves have long feared that autonomy for Santa Cruz would prevent what they consider a more equitable distribution of natural gas profits. They also have pushed for Congress to change the constitution to give the country's indigenous majority greater representation in a government traditionally dominated by Bolivians of European descent.
Some protesters said that despite Rodriguez's assumption of power, nationalization of the fuel sector remained a pressing demand.
"It's not important to us what the Congress decides about Mesa, Vaca Diez or Cossio," said Eugenio Rojas, a protest leader from the Aymara Indian tribe. "They're all part of a political structure that we believe must change."
Thursday's demonstrations were among the fiercest since the latest round of protests began on May 14. One miner traveling to a protest in Sucre was shot dead by the Bolivian military. In Santa Cruz, demonstrators occupied installations belonging to international energy companies while the military reportedly began deploying troops to the region.
Airport workers announced a 48-hour strike to demand early elections, and police clashed with demonstrators in major cities. In La Paz, residents reported food and fuel shortages due to the protests.
Several indigenous and municipal leaders in the country's northern highlands had said they would begin hunger strikes to oppose Vaca Diez.
Special correspondent Bill Faries in La Paz contributed to this report.