Peru's former president Pedro Castillo was placed in provisional detention on Thursday, a day after he was ousted by lawmakers and arrested, accused of attempting a coup.
Prosecutors carried out a dawn raid on the presidency and some ministerial offices in search of evidence against Castillo, who is being investigated for "rebellion and conspiracy."
A judge granted the request, despite the argument of Castillo's lawyer Victor Perez that "the crime of rebellion was not committed" because it did not materialize.
Castillo's efforts to dissolve Congress and rule by decree were quickly stamped out by lawmakers who voted him out of office on Wednesday in a day of high drama, by the end of which he was in jail and his former vice president Dina Boluarte had taken over.
Mexico's President Andres Manuel Lopez Obrador revealed that Castillo had requested asylum, which he was willing to grant, but the leftist was arrested before he could arrive at the country's embassy.
Mexico was holding consultations with Peru's new government about giving asylum to Castillo, Foreign Minister Marcelo Ebrard later announced.
With Boluarte under mounting pressure to quell the political turmoil rocking the country, hundreds of Castillo supporters staged protests in the capital Lima and other cities.
- 'Peru is with you!' -
A thousand protesters marched through Lima demanding Castillo's release before police dispersed the demonstration with tear gas, making several arrests.
"Pedro Castillo, Peru is with you!" and "If there is no liberation, there will be revolution!" the leftist's supporters chanted.
Protesters in the southern Andean cities of Ayacucho and Puno, where Castillo has a lot of support, demanded early elections.
Boluarte took the oath of office shortly after the impeachment vote, vowing to serve out the rest of Castillo's term, until July 2026.
The 60-year-old lawyer must now form her first ministerial cabinet, which will be an early indication of whether she is likely to survive in office.
However, without her own political party in Congress, Boluarte faces an uphill battle to stay in power.
"She has no party in Congress, she is alone," Peru's former president Ollanta Humala told local television Wednesday night.
"She does not have the tools to govern, she should call for an early election," added Humala, who served from 2011 to 2016.
"Today's truce will last a month or maybe more, but then the country's big problems will come to the fore."
But right-wing political heavyweight Keiko Fujimori, the daughter of ex-president Fujimori, said her party would support the new president.
"Let's hope that the president appoints a broad-based cabinet, a very good cabinet and we must all do everything possible to make it work well," she tweeted.
The United States praised Peru for ensuring "democratic stability," and the European Union expressed its support for the "political, democratic and peaceful solution adopted by the Peruvian institutions."
- Dizzying hours -
The dramatic events in Peru are the latest in a long line of political crises for the country, where impeachment proceedings are common, and which is now on its sixth president since 2016.
Castillo's 17-month rule was overshadowed by multiple cabinet reshuffles, six investigations against him and his family, mass protests demanding his removal, and a power struggle with the opposition-backed Congress.
The current crisis began as the former rural school teacher on Wednesday faced his third impeachment attempt since unexpectedly wresting power from Peru's traditional political elite.
In a televised address, the 53-year-old announced he was dissolving the opposition-dominated Congress, imposing a curfew and would rule by decree for at least nine months.
As criticism poured in over the speech, lawmakers defiantly gathered to approve the impeachment motion.
By Wednesday night, Castillo had been transferred to the Barbadillo police penitentiary in east Lima, where graft-convicted former president Alberto Fujimori -- himself removed by Congress in 2000 -- is serving out his sentence.