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.
After the impeachment vote, Castillo had left the presidential palace with a bodyguard, heading to the Lima police headquarters before his arrest was officially announced.
His supporters criticised their leader’s ousting.
“I want to denounce the fact that our president has been kidnapped by the national police, that he has been detained with premeditation and treachery by Congress,” said retired soldier Manuel Gaviria, 59.
Castillo came out of seemingly nowhere to win 50.12 per cent of votes in a June 2021 runoff election against rightwing Keiko Fujimori, the corruption-charged daughter of graft-convicted ex-president Alberto Fujimori.
He was born in a small village where he worked as a teacher for 24 years, and was largely unknown until he led a national strike in 2017 that forced the then-government to agree to pay rise demands.
Castillo sought to portray himself as a humble servant of the people, traveling on horseback for much of his presidential campaign, and promising to end to corruption.
However allegations against him quickly flooded in.
The investigations he is facing range from alleged graft and obstruction of justice to plagiarising his university thesis.
In October, Peru’s attorney general also filed a constitutional complaint accusing Castillo of heading a criminal organisation involving his family and allies.
Castillo and his lawyers long argued the investigations against him were part of a plot to unseat him.
“This intolerable situation cannot continue,” he said earlier on Wednesday as he announced he planned to convene a new Congress to draft a new constitution within nine months.
“NOW FORMER PRESIDENT”
Hundreds of protesters gathered in front of Congress ahead of the vote.
“We are tired of this corrupt government that was stealing from day one,” said 51-year-old Johana Salazar.
Ricardo Palomino, 50, a systems engineer, said Castillo’s attempt to dissolve parliament was “totally unacceptable and unconstitutional. It went against everything and these are the consequences”.
Ahead of the impeachment, the United States demanded Castillo “reverse his decision”, before saying it no longer considered him to be the president.
“My understanding is that, given the action of the Congress, he is now former president Castillo,” State Department spokesman Ned Price told reporters, saying lawmakers took “corrective action” in line with democratic rules.
Latin American governments voiced deep concern and appealed for respect for democracy, but there were also hints of support for Castillo from fellow leftist leaders.
Mexican President Andres Manuel Lopez Obrador, one of Castillo’s staunchest allies, blamed “economic and political elites” for a hostile environment since the beginning of his “legitimate presidency”.
The government of Gustavo Petro, Colombia’s first left-wing president, called for dialogue involving “all political actors”, adding that “democracy requires the recognition of the popular will expressed both in the elections for president and for Congress”.
Brazil was more critical of Castillo’s actions, calling his attempt to dissolve Congress a “violation” of democracy and the rule of law.