Carlos Mesa, the former president who came second in last month’s election, celebrated Mr. Morales’s resignation, which he characterized as “the end of tyran ny.”

It remained unclear on Sunday night who would take power, as several officials in the line of succession had resigned. Mr. Morales’s resignation statement was expected to be read in Congress Monday.

Mexico’s foreign minister, Marcelo Ebrard, said on Twitter on Sunday night that his country would offer Mr. Morales asylum if he sought it. Late Sunday night, Mr. Morales said in a statement on Twitter that the police were seeking to arrest him “illegally” and that “violent groups” had assaulted his home.

Mr. Morales’s departure is a milestone in the spasms of unrest that have roiled Latin America in recent months. Several leaders in the region have been bedeviled by street protests, acts of vandalism and deepening political polarization — dynamics exacerbated by underperforming economies and rising outrage over inequality.

As it became clear that the military would turn on him, Mr. Morales flew with Mr. García and a small number of aides from La Paz to Chimoré, in the state of Cochabamba. It was unclear whether Mr. Morales intended to leave Bolivia or stay in that area, which is home to coca leaf growers and has been a stronghold of support.

Mr. Morales’s increasing grip on the country had been worrying critics — and many supporters — for years.