LIMA, Dec 7 (AFP) - Peru's leftist president Pedro Castillo was ousted by lawmakers and arrested Wednesday in a dizzying series of events in a country long prone to political upheaval.

Dina Boluarte, a 60-year-old lawyer who had been vice president, was sworn in as Peru's first female president just hours after Castillo tried to dissolve Congress in a move criticized as an attempted coup.

The day of high drama began with Castillo facing his third impeachment attempt since the former rural school teacher unexpectedly won power from Peru's traditional political elite in an election 18 months ago.

In a televised address to the nation, the 53-year-old announced that he was dissolving the opposition-dominated Congress, installing a curfew, and would rule by decree.

As criticism poured in over the address, lawmakers defiantly gathered earlier than planned to debate the impeachment motion and approved it, with 101 votes out of a total of 130 lawmakers.

Castillo was impeached for his "moral incapacity" to exercise power, after a litany of crises including six investigations against him, five cabinet reshuffles and large protests.

The constitution allows impeachment proceedings to be brought against a president based on alleged political rather than legal wrongdoing -- making impeachments commonplace in Peru.

Castillo was arrested on Wednesday evening, said Marita Barreto, coordinator of a team of prosecutors who deal with government corruption.

A source in the attorney general's office told AFP he was being investigated for rebellion.

Castillo became the third president since 2018 to be sacked under the "moral incapacity" provision in the constitution.

Within two hours, Boluarte took the oath of office in front of Congress to serve out the rest of Castillo's term, until July 2026.

Peru is no stranger to political instability: it had three different presidents in five days in 2020, and is now on its sixth president since 2016.